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

Feeding variables to a panel group similar to a data table  RSS feed

 
Christopher Whu
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have created a nice looking client detail display page, its basically just a bunch of panelgroups. i would like to be able to reuse this display to show customer details no matter what the backing bean for the page (just keep using a ui:include).

ideally i would like something like h:datatable where i can just set the value and the var...


basically something like this: (pseudo coded)




and then my include would look like



Is there a tool like this currently out there. I am just trying to prevent code re-use in my xhtml.

 
Brendan Healey
Ranch Hand
Posts: 218
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, you can use ui:param like this:



Then you can access #{beanParameter.propertyName} in the included file.

Regards,
Brendan.
 
Christopher Whu
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i am going to give this a whirl today! Ty so much.
 
Christopher Whu
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It works!!! What a time saver... I probably have that panelgroup arrangement in like 4 or 5 files, now i can just reuse it...

ty ty ty...
 
Brendan Healey
Ranch Hand
Posts: 218
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Great. One thing to bear in mind is that if you are trying to reference a method from the included file, i.e.

...valueChangeListener="#{beanParameter.methodName}" jsf thinks that methodName is a property and
it won't work. The fix is to use the syntax:

...valueChangeListener="#{beanParameter[methodName]}"

Regards,
Brendan.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!