• Post Reply Bookmark Topic Watch Topic
  • New Topic

JSTL conversion question

 
Melinda Savoy
Ranch Hand
Posts: 387
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a test that I am trying to setup in my JSP page whereby I can test 3 criteria that have to be met before displaying my code. The error I am getting is:

Error:javax.servlet.jsp.el.ELException
An exception occured trying to convert String "A" to type "java.lang.Long"

The criteria where this test is is not a long but a CHAR value. Any help or direction would be greatly appreciated. Regards.

The code in my jsp is as follows:

 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65530
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Given the message, it's probably complaining about:



So what is req.recStatus?
 
Melinda Savoy
Ranch Hand
Posts: 387
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the reply, Bear. The recStatus is a CHAR property. Therefore the reason for my confusion.

Thanks.
[ April 09, 2007: Message edited by: Melinda Savoy ]
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65530
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Could you post the code for the property accessor for recStatus?
 
Melinda Savoy
Ranch Hand
Posts: 387
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear,

A collegue explained that he ran into the same problem and needed to make a boolean value for this CHAR because jstl was having a hard time trying to convert to a CHAR value(?). Thanks for your help.

Here is my code:

 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65530
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's actually a much better way to do it in any case because now nothing external to the bean needs to know that "active" is the char "A" -- whereas before, your page had to hard-code the value. This is a poor practice that is best avoided.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!