I've written a simple tag handler in order to print out several user data (from a form).
All works fine - except the last attribute named "programLanguages" - it deals with a List rather than with a String.
Below please find the tag "advice" which I've place into the "result.jsp":
When I run the result.jsp, I get the following exception:
org.apache.jasper.JasperException: Unable to convert string "[cpp, java, vb]" to class "java.util.List" for attribute "programLanguages": Property Editor not registered with the PropertyEditorManager
Instead, when I place the "programLanguages" attribute within my custom tag, it works fine:
The body of the <jsp:attribute> is always evaluated and converted into a String, and this is not possible for a List.
You can pass the List as an attribute of the customtag, like you already did.
For standard or custom action attributes that accept a request-time expression
value, the Container must evaluate the body of the <jsp:attribute> action and
use the result of this evaluation as the value of the attribute. The body of the
attribute action can be any JSP content in this case. If the type of the attribute
is not String, the standard type conversion rules are applied, as per
Section JSP.18.104.22.168, "Conversions from String values".
In future, I'll rely not only on the book, but also on the spec ...
It can certainly help you on the newer topics like the <jsp:attribute>, <jsp:body> and so on
Also have a look at the following example where you can force the input of a custom tag attribute to be of a certain type