• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Getting NumberFormatException due to usage of wrong EL syntax

 
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I've a dropdown where i'm trying to display the dropdown values using EL in a c:forEach Loop as shown below :

In the above code, category is a bean class which has following fields:

I'm getting the selected dropdown value in controller servlet as shown below :

When i printed the above line i.e.
i got : instead of selected catID value, which means EL syntax which i'm using to access the catID from category object is wrong.
i tried using the following syntax & by removing "" around EL in 'value' attribute,but both of them didnt work.
Can any one please let me know what is correct usage here?
 
Sheriff
Posts: 22784
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't see anything wrong with your syntax. Are you sure that EL is enabled? If you have a web.xml that is specified to use the Servlet 2.3 spec, then EL is disabled by default.
 
karthik chellappan
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Rob,

Servlet version i had was : 2.4
JSP version : 2.0
Server : Apache Tomcat/5.5.27

I saw following in web.xml of the above application:


when i created new web application, the default declaration was of version 2.4 i.e.


I used the above line of code in place of existing code in web.xml and it worked. Thanks for the reply.
 
Rob Spoor
Sheriff
Posts: 22784
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That version 2.5 should have worked, unless your servlet container (Tomcat?) doesn't support it. Which container do you use?
 
karthik chellappan
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Rob,

I'm using Apache Tomcat/5.5.27.
 
Sheriff
Posts: 67747
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Just look at the code at the browser with view source. Has the EL been evaluated? If not, that's the problem you need to solve.
 
karthik chellappan
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Bear,

I just changed my root declaration in web.xml to version 2.5 and for my surprise, it worked perfectly fine. I checked source in the browser and saw that EL was evaluated properly which was not happening earlier for version 2.5. When i changed to 2.4 version i didn't get exception (it worked fine) and now i'm not getting exception in 2.5 version as well. So i'm quite confused and not sure why i was getting initially this error.
 
karthik chellappan
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I was encountering this problem intermittently and on googling i got below link where they say it could be a bug in Tomcat.

EL

So to avoid this problem i have to include
in jsp page or add in web.xml even though EL is enabled by default for Servlet 2.4 spec and above.

 
Bear Bibeault
Sheriff
Posts: 67747
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You should never have to put anything on the pages to enable the EL.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic