wood burning stoves*
The moose likes JSF and the fly likes JSTL - gt/le not working with variables Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "JSTL - gt/le not working with variables" Watch "JSTL - gt/le not working with variables" New topic
Author

JSTL - gt/le not working with variables

koushik Rock
Greenhorn

Joined: Dec 07, 2010
Posts: 6
I have a block of code like this -->

now, the code flow should reach block 1, but it is interpreting remainderQty as string and failing the comparison and end up reaching block 2.
Can anyone experienced the same? What is the alternative/fix available for the same?
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15959
    
  19

There are several problems here.

First of all, "Code should not flow" in your View Definition. The View Definition is not the place to put logic. It pollutes the Model/View/Controller Separation of Concerns contract. Logic should be in backing beans. The View should only contain graphic templates.

Secondly, JSTL is not recommended with JSF. JSTL assumes a servet/JSP architecture and JSF works on completely different principles, so JSTL frequently malfunctions. For any View-related conditions that you need to specify, JSF has native constructs that work much better than JSTL.

Finally, the View Template Language (also known as View Definition Language or ".xhtml") is an XML format document and therefore must adhere to the XML syntax rules. Because the less-than, greater-than, quote, apostrohe and ampersand characters all have specific meanings in XML, any attempt to insert them into text values can result in ambiguous syntax which must be resolved by using CDATA or entity escapes.


Customer surveys are for companies who didn't pay proper attention to begin with.
koushik Rock
Greenhorn

Joined: Dec 07, 2010
Posts: 6
thanks Tim for the reply.
I have used the following facelet and resolved the issue.

where ui is "xmlns:ui="http://java.sun.com/jsf/facelets".
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15959
    
  19

Much more tidy, no?
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: JSTL - gt/le not working with variables
 
Similar Threads
javax.servlet.jsp.JspException in Application
jsp: include not working...
Total newby JSP if block question is this legal
how to avoid show buttons
Nesting JSTL Tags