• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

Evaluating two Float Values Using JSTL

 
Ranch Hand
Posts: 1938
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am getting a EL Parse error when trying to evaluate two float values on code line 12.

 
 
Marshal
Posts: 24594
55
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can't have the "<" character inside a text node like that. When the compiler sees "<" it wants that to be the start of some piece of element markup. To use that character you have to escape it like so: &lt;
 
Bartender
Posts: 20838
125
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually, the part of the JSP that is offending isn't the JSTL, it's the EL expression within the JSTL tag. EL is the Java Expression Language.

As Paul said, you can get around the problem by replacing the offending angle bracket with its XML entity equivalent. However, in Unified EL, I think you can also use "lt" and "gt" as operators. And even say things like this:


Then again, putting complex expressions in EL is a horrible thing to do. It's absolutely murder to debug. A much better approach is to create a javabean with all the computations already done by the controlling logic and using the useBean tag to expose that bean and its properties. Or, in your case, since you want logic on line items in a table, you might provide a decorator object that presents the rows in the table with their availability computations. Like so:
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!