JSP 2 and Servlet 2.4 broke my custom tags
We recently switched to Servlet 2.4 and JSP 2 on a project and our custom tags no longer work. We have tags like:
<myTags:someTag value="${x}" />
and once in the tag we evaluated x bean and went from there. Now the evaluation happens directly in the JSP and we get a String (apparently x.toString()) set for the value attribute.
There are not a lot of tags and I could adapt them in a few days but how can I do that? I could not find anything on the web (or maybe I'm not looking where I should).
How do I pass the x bean to my tag开发者_如何学运维 and evaluate it there and not allow it to be evaluated in the JSP?
P.S. I do not want to deactivate the EL-engine
Thank you!
If you redeclare web.xml
as Servlet 2.4 as follows
<web-app
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4">
and the tld
file as JSP 2.0 taglib as follows:
<taglib
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd"
version="2.0">
Then you can add <rtexprvalue>true</rtexprvalue>
entries to tag attributes in the TLD file which are expecting EL values. E.g.
<attribute>
<name>value</name>
<rtexprvalue>true</rtexprvalue>
</attribute>
It namely defaults to false
.
精彩评论