Help coderanch get a
new server
by contributing to the fundraiser
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

binding and el expression in datatable

 
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
how can we pass an el expression to datatable in xhtml?

For example
<c:set var="tempparam" scope="request" value="#{backingbean.nameofbinding}" />
<h:datatable binding="#{tempparam}" ....></h:datatable>

i get that tempparam from some other request object.How can we set it as an el expression for binding instead of plain string.


Thanks
Sudharshan Tettu
 
Saloon Keeper
Posts: 28054
198
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, first off, get rid of the JSTL. JSTL and JSF don't go together well, and you don't need JSTL for JSF anyway. I also discourage using "binding" on controls unless you actually intend on dynamically rearranging the UI. Value binding is simpler, cleaner and doesn't require you to burden your backing bean with arcane JSF-specific code.

Secondly, there's absolutely no problem with using a symbolic value in EL expressions. I have lots of cases where I do a <ui:include> that passes the name of a component to the included xhtml to be dynamically substituted using the <ui:param> element. The only limitation is that while most JSF attributes may be EL expressions, some have to be fixed text, so it's always good to check the documentation on the tag in question. Things like value bindings, however, usually can be EL, so that's not much of a problem.
 
sudharshan tettu
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Am not getting you could you please give me an example how can I dynamically substitute the value for binding at runtime using ui:param
Thanks
 
Tim Holloway
Saloon Keeper
Posts: 28054
198
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


Excerpt from included file listing.xhtml
">
 
sudharshan tettu
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Tim ,but my issue with binding for example we customized it like this
<ht:datatable binding="#{mytable}">
<h:column>
#{mutable.rowIndex}
</h:column>
</ht:datatable>


And in my datatable it's just an xhtm page where I would be invoking the jsf datatabl with some customization.
Like


<h:datatable binding="#{binding}">
<ui:insert/>
</h:datatable>

But my problem is the binding attr we used inside the column is not getting resolved when we pass it like that into the XHTML(the tag)


 
Tim Holloway
Saloon Keeper
Posts: 28054
198
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
<ui:insert> is really not a good way of doing stuff like that. Use ui:insert for things like simple string values and use ui:include for more complex elements.
 
sudharshan tettu
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hey tim I got it, let me try with ui:include and other workarounds
reply
    Bookmark Topic Watch Topic
  • New Topic