0

So I'm trying to find the best approach to solve the following problem.

I have the following pages:

1.insert.xhtml(Where I have a form to register a client)

2.find.xhtml(Where I have a table for the registered clients, where I can edit and exclude them)

In the find.xhtml page I have a context menu with the edit option, if I click on it, it'll open a <p:dialog> with the same insert.xhtml registration form, except for the submit button that have a different name and action-listener.

I also have other registrations that needs a client reference on it, ex.: registering a car sell to a registered client. The way I select an already registered client to add it to the sell form is by calling a popup with the same code in the find.xhtml table and select a client there, except this table have a button on its footer called select.

So what I'm asking is a way to reuse those forms/table codes being able to add a few components on them as needed. Is there a way to do it?

EDIT: Just like a template

EDIT2: Nevermind, I just solved it by using <ui:decorate>.

Rodrigo Cavalcante
  • 1,577
  • 4
  • 14
  • 21

1 Answers1

0

I am not sure if <ui:decorate> is the best solution. I have seen many examples of templating where it is used a composition. I like a lot this tutorial from IBM:

http://www.ibm.com/developerworks/java/library/j-jsf2fu2/index.html

they explain in detail how to create a template.

Oscar Castiblanco
  • 1,626
  • 14
  • 31