You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by arjan tijms <ar...@mbuyu.nl> on 2006/12/28 12:09:49 UTC

Escaping EL doesn't work in Tomcat 6?

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


Re: Escaping EL doesn't work in Tomcat 6?

Posted by Remy Maucherat <re...@apache.org>.
Tim Funk wrote:
> Is this issue http://issues.apache.org/bugzilla/show_bug.cgi?id=41257
> and http://issues.apache.org/bugzilla/show_bug.cgi?id=41258
> 
> I think these are the trouble:
> 
> Lines 2776-2777 in org.apache.jasper.compiler.Generator
> 
> TagAttributeInfo tai = attr.getTagAttributeInfo();
> String type = tai.getTypeName();
>               ^^^ <-- Is null

Yes, I could figure it out, but I'm not totally sure what it should be 
doing then.

Rémy

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


Re: Escaping EL doesn't work in Tomcat 6?

Posted by Remy Maucherat <re...@apache.org>.
arjan tijms wrote:
> Indeed, I mentioned this in the bug report relating to EL in dynamic 
> attributes. This bug report I think was wrongfully marked as a 
> duplicate. While the original problem was indeed related to using EL in 
> dynamic attributes too, the specific problem here is that escaping EL 
> doesn't work either. I merely tried escaping EL as a workaround for the 
> NPE bug.
> 
> So to sum up, I think we have two seperate bugs here:
> 
> 1) EL in dynamic attributes causes NPE.
> 2) Escaping of EL doesn't work.

This is not quite correct. I think you should provide a test WAR, as I 
asked earlier.

Rémy

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


Re: Escaping EL doesn't work in Tomcat 6?

Posted by arjan tijms <ar...@mbuyu.nl>.
Tim Funk wrote:

> Is this issue http://issues.apache.org/bugzilla/show_bug.cgi?id=41257
> and http://issues.apache.org/bugzilla/show_bug.cgi?id=41258
>
> I think these are the trouble:
>
> Lines 2776-2777 in org.apache.jasper.compiler.Generator
>
> TagAttributeInfo tai = attr.getTagAttributeInfo();
> String type = tai.getTypeName();
>               ^^^ <-- Is null
>

Indeed, I mentioned this in the bug report relating to EL in dynamic 
attributes. This bug report I think was wrongfully marked as a 
duplicate. While the original problem was indeed related to using EL in 
dynamic attributes too, the specific problem here is that escaping EL 
doesn't work either. I merely tried escaping EL as a workaround for the 
NPE bug.

So to sum up, I think we have two seperate bugs here:

1) EL in dynamic attributes causes NPE.
2) Escaping of EL doesn't work.




-- 
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


Re: Escaping EL doesn't work in Tomcat 6?

Posted by Tim Funk <fu...@joedog.org>.
Is this issue http://issues.apache.org/bugzilla/show_bug.cgi?id=41257
and http://issues.apache.org/bugzilla/show_bug.cgi?id=41258

I think these are the trouble:

Lines 2776-2777 in org.apache.jasper.compiler.Generator

TagAttributeInfo tai = attr.getTagAttributeInfo();
String type = tai.getTypeName();
               ^^^ <-- Is null

But the snippet above is contained in a if/else which wraps too many 
pages for me at the moment to try to determine a fix.


-Tim

Remy Maucherat wrote:
> arjan tijms wrote:
>> 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?
> 
> Please provide a test war if you can. Tag with dynamic attribute names 
> are supposed to accept EL.
> 

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


Re: Escaping EL doesn't work in Tomcat 6?

Posted by Remy Maucherat <re...@apache.org>.
arjan tijms wrote:
> 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?

Please provide a test war if you can. Tag with dynamic attribute names 
are supposed to accept EL.

Rémy

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