Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Help with creating common xhtml code  RSS feed

David Warner
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Greetings: still pretty new to JSF. I hope this question makes sense. I'm happy to followup if more details are required.

Using JSF 1.2, Facelets, RichFaces 3.3

As an example, take a Car object setup as a backing bean. Within the xhtml code I can reference this bean using normal expressions:
#{car.prop1}, #{car.prop2) ... etc.

Now consider creating a rich:dataTable like:

This table includes a command link for each row that displays a modal panel to allow the details of a single car to be displayed/edited. Like this:

Setup like this the panel xhtml references a specific car's properties like:
#{cars.currentCar.prop1}, #{cars.currentCar.prop2) ... etc.

So I have all of this working in both the single object example and selecting an object from the table.

What I desire is one block of xhtml that I can <ui:include=...> so that the display/edit form is common regardless of how it evoked (i.e. from the table or a single object search). Where I'm getting stuck is on how to construct the code so that it refers to the same bean. In this example both 'car' and 'cars.currentCar' represent the same object, but within different beans.

Did I explain this well? Pretty sure I'm making this harder then it should be, but can't seem to figure out the correct approach.

Really appreciate any thoughts or assistance you can provide.

Tim Holloway
Posts: 18705
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Pass the object as a parameter to the included file. It goes something like this, but I may not have remembered it exactly.

This is the shape of it, although I may have mangled the details.
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!