tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From arjan tijms <arjan.ti...@mbuyu.nl>
Subject Escaping EL doesn't work in Tomcat 6?
Date Thu, 28 Dec 2006 11:09:49 GMT
We're using a number of custom tags that accept JSF (deferred) EL 
through dynamic attributes. In JSP 2.1 this is illegal. I therefore 
tried to deactivate expression evaluation by escaping the #{ pattern, 
but it seems that Tomcat 6.0.7 ignores this?

E.g.

<x:myTag id="someID" someDynamicAttribute="\#{someBean.someProp} />

Where myTag would be declared like this:

<tag>
       <description>...</description>
       <name>myTag</name>
       <tag-class>com.someClass</tag-class>
       <body-content>empty</body-content>
             <attribute>
           <description>...</description>
           <name>id</name>
           <required>false</required>
           <rtexprvalue>false</rtexprvalue>
       </attribute>

       <dynamic-attributes>true</dynamic-attributes>
   </tag>

This results in a:

org.apache.jasper.JasperException: Unable to compile class for JSP


where the deepest nested stack trace starts with:

java.lang.NullPointerException
    at 
org.apache.jasper.compiler.Generator$GenerateVisitor.evaluateAttribute(Generator.java:2777)


    at 
org.apache.jasper.compiler.Generator$GenerateVisitor.generateSetters(Generator.java:2988)


    at 
org.apache.jasper.compiler.Generator$GenerateVisitor.generateCustomStart(Generator.java:2169)


    at 
org.apache.jasper.compiler.Generator$GenerateVisitor.visit(Generator.java:1689) 

    at org.apache.jasper.compiler.Node$CustomTag.accept(Node.java:1507)
    at org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2336)
    at org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2386)
    at 
org.apache.jasper.compiler.Generator$GenerateVisitor.visit(Generator.java:1705) 

    at org.apache.jasper.compiler.Node$CustomTag.accept(Node.java:1507)
    at org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2336)


In a simple outputText escaping is ignored too.

Something like:

<h:outputText value="\#{someBean.someProp}" />

would render a literal "\" before the value of "someProp".

Escaping EL is mentioned here: 
http://java.sun.com/javaee/5/docs/tutorial/doc/JSPIntro7.html
e.g.

"Escape the #{ or ${characters as follows:
|some text \#{ some more\${ text
| and
|<my:tag someAttribute="sometext\#{more\${text" />"


|


-- 
It's a cult. If you've coded for any length of time, you've run across someone from this warped
brotherhood. Their creed: if you can write complicated code, you must be good.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message