Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

JSP Tags, EL and toString() method

843838Jun 4 2007 — edited Jun 6 2007
Hi,

I want to pass a Java object to a custom tag via EL, but am finding that since the class has a toString() method, EL automatically converts the class to a string using the toString method. Consequently, I get an error because the string cannot be cast back to the parent object in the tag handler class.

I played around with a dummy class and found that if the toString() method wasn't defined, EL would pass the object as is without converting to a string.

Is there some reason for this behaviour and is there some way I can get around this without having to remove the toString() method ? The object I am trying to process is from an external library, so I can't modify it.

Thanks for any tips on this.


Paul Samuel
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 4 2007
Added on Jun 4 2007
6 comments
1,267 views