JSP Tags, EL and toString() method
843838Jun 4 2007 — edited Jun 6 2007Hi,
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