• 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
  • Tim Cooke
  • paul wheaton
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Rendered attribute and Expression Language

 
Ranch Hand
Posts: 32
Eclipse IDE Ruby Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi!
I've something like this:

<h:dataTable value="#{SomeBean.someList}" var="List">
<h:column>
<h:outputText value="some text" rendered="..."></h:outputText>
</h:column>
</h:dataTable>

I need to compare two values one from 'List' and one from 'SomeBean'. I tried something like this: rendered="#{List.value} < #{SomeBean.value}", but it didn't work. Is there any way to compare these two values by EL?
 
Ranch Hand
Posts: 114
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


This should be
 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
you can't use < for comparing two values use le(less than equal)"#{value1 le value2}"
 
Saloon Keeper
Posts: 28812
212
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
Actually, I think you can, but you have to use the entity version of the less-than operator so that the XML parser doesn't mistake it for part of an element definition.

In other words, not:

rendered="#{a < b}"

but:

rendered="#{a &lt; b}"

But having said that, I really don't recommend doing any sort of logic on the web page itself unless it's unavoidable. I normally use a boolean property in the backing bean or a formatter in the backing bean.
 
I'm thinking about a new battle cry. Maybe "Not in the face! Not in the face!" Any thoughts tiny ad?
Clean our rivers and oceans from home
https://www.kickstarter.com/projects/paulwheaton/willow-feeders
reply
    Bookmark Topic Watch Topic
  • New Topic