• Post Reply Bookmark Topic Watch Topic
  • New Topic

NumberFormatException while using a value set using request.setAttribute

 
vidyasagar Namburi
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I'm using EL in a JSP and setting a variable in two ways as shown below



And later used the variable "periodVal" as shown below



I understand that, for the first case, the "${periodVal}" in EL returns an object(or may be a string) and hence the NumberFormatException as the 'begin' and 'end' values for a c:forEach tag should be integer.

Does c:set work the same way? Because I'm facing the same issue even with c:set aswell.

Please let me know if there is a way to get an integer value or typecast it t integer while using EL as shown above for the c:forEach tag while getting from a set request attribute or set using a c:set tag.

I'm using Tomcat7.0.41

Thanks
Vidyasagar
 
E Armitage
Rancher
Posts: 989
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JSTL has automatic type conversion as explained here :https://today.java.net/pub/a/today/2003/10/07/jstl1.html

So verify that the variables are set to the values you think they are and post the full stack trace that you got.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!