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

Comparators in loop  RSS feed

 
sreeni san
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • 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
 
Adam Mazurek
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You should use rendered attribute rather than c:if.
 
Tim Holloway
Bartender
Posts: 18705
71
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • 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.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!