• 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
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

Comparators in loop

 
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have my code in a *.xhtml, the snippet of which is as follows

<html ..........
xmlns:c="http://java.sun.com/jstl/core">
<c:set var="finalrating" value="${prod.rating}"/>
<c:if test="${finalrating == -1.0}">
<h:graphicImage value="blank.gif"/>
</c:if>
<c:if test="#{finalrating > -1.0}">
<h:graphicImage value="full.gif"/>
</c:if>
</html>

The problem I am facing is that the comparators ('==', '>') are not working in the <c:if> (also tried <c:when>, but things did'nt work). My bean returns a float value which will be like -1.0 or 1.0, etc.,


Please help, this is urgent!!!

Thanks,
Sreeni
 
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You should use rendered attribute rather than c:if.
 
Saloon Keeper
Posts: 25466
180
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

Originally posted by Adam Mazurek:
You should use rendered attribute rather than c:if.



In fact, mixing JSTL and JSF is generally not a good idea. While some of the worst incompatibilities between them have now been resolved, JSF tags are pretty much pure view-oriented, and JSTL is geared towards placing some or all of the controller logic on the view.
 
To avoid criticism do nothing, say nothing, be nothing. -Elbert Hubbard. Please critique this tiny ad:
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic