OGNL and JSP 2.1 - are there plans to fix?

View: New views
8 Messages — Rating Filter:   Alert me  

OGNL and JSP 2.1 - are there plans to fix?

by mraible :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Are there any plans to fix OGNL's # (or provide a workaround) for JSP 2.1?

From the bottom of http://cwiki.apache.org/WW/ognl.html:

Under JSP 2.1 the # character is now used by the JSP EL.

This may cause problems with some applications that use the OGNL # operator.

One quick-fix is to disable the JSP EL in a JSP 2.1 container (like GlassFish) by adding a jsp-config element to the web.xml

  <jsp-config>
    <jsp-property-group>
      <url-pattern>*.jsp</url-pattern>
      <el-ignored>true</el-ignored>
    </jsp-property-group>
  </jsp-config>

Now that MyFaces 1.2 is out, I'd like to try mixing Struts 2 and JSF in a single application. I can use Facelets for JSF, but it might make sense to use JSP for both of them so there's only one view technology. To do that, I need to use JSP 2.1, which looks like it has issues with OGNL. Or maybe it's better to use different extensions for Struts 2 vs. JSF pages and turn off EL for JSF pages?

Does the Struts JSF Plugin work with a JSF 1.2 implementation or does it not care?

Thanks,

Matt

Re: OGNL and JSP 2.1 - are there plans to fix?

by mraible :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Here's a (possibly better) solution:

    <jsp-config>
      <jsp-property-group>
        <url-pattern>*.jsp</url-pattern>
        <deferred-syntax-allowed-as-literal>true</deferred-syntax-allowed-as-literal>
      </jsp-property-group>
    </jsp-config>

Information found at http://today.java.net/lpt/a/272#backwards-compatibility.

Caveats: you need a servlet 2.5 XSD at the top of your web.xml and it only seems to work in Tomcat 6.0.13, not Jetty 6.1.5.

Matt

mraible wrote:
Are there any plans to fix OGNL's # (or provide a workaround) for JSP 2.1?

From the bottom of http://cwiki.apache.org/WW/ognl.html:

Under JSP 2.1 the # character is now used by the JSP EL.

This may cause problems with some applications that use the OGNL # operator.

One quick-fix is to disable the JSP EL in a JSP 2.1 container (like GlassFish) by adding a jsp-config element to the web.xml

  <jsp-config>
    <jsp-property-group>
      <url-pattern>*.jsp</url-pattern>
      <el-ignored>true</el-ignored>
    </jsp-property-group>
  </jsp-config>

Now that MyFaces 1.2 is out, I'd like to try mixing Struts 2 and JSF in a single application. I can use Facelets for JSF, but it might make sense to use JSP for both of them so there's only one view technology. To do that, I need to use JSP 2.1, which looks like it has issues with OGNL. Or maybe it's better to use different extensions for Struts 2 vs. JSF pages and turn off EL for JSF pages?

Does the Struts JSF Plugin work with a JSF 1.2 implementation or does it not care?

Thanks,

Matt

Re: OGNL and JSP 2.1 - are there plans to fix?

by Ted Husted :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 7/18/07, mraible <matt@...> wrote:
> Are there any plans to fix OGNL's # (or provide a workaround) for JSP 2.1?

AFAIK, the only place working on this issue has been mentioned is in
the threads you've started, Matt. A patch or a workaround would be a
Good Thing, if there are volunteers to do the work. Of course, you
have full access to the documentation wiki, if there's something you'd
like to document.

-Ted.

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


Re: OGNL and JSP 2.1 - are there plans to fix?

by DNewfield :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

mraible wrote:
> Are there any plans to fix OGNL's # (or provide a workaround) for JSP 2.1?

I've not tried updating to 2.1 and testing this, but under "Backward
Compatibility"
http://java.sun.com/developer/technicalArticles/J2EE/jsp_21/ suggests:

Escape each instance of the #{ characters using a backslash: \#{.

Does that work?

I.E., does the following work in 2.1?
<s:select key="batchSize"
           list='\#{"10":"10",
                    "25":"25",
                    "50":"50"}'/>


-Dale

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


Re: OGNL and JSP 2.1 - are there plans to fix?

by DNewfield :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Dale Newfield wrote:
> I've not tried...

And that's the problem right there.  Even just more web research found
an answer:

http://www.devzuz.org/blogs/bporter/2006/08/05/1154706744655.html

clearly answers my question: "But, to escape it with \#{ doesn't work on
Tomcat 5 and other 2.0 containers."

(And I wasn't subscribed to the struts-dev list long enough ago to
notice Musachy's similar workaround suggestion:
http://www.nabble.com/2.1-and-tooltips-tf3535099.html#a9867353 )

-Dale

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


Re: OGNL and JSP 2.1 - are there plans to fix?

by mraible :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Here's what I've found out:

On Tomcat 6, the following will work to disable processing of #{}:

1. On a per-page basis using a page directive:

<%@ page deferredSyntaxAllowedAsLiteral="true" %>

2. Disable for all JSPs in web.xml:

    <jsp-config>
      <jsp-property-group>
        <url-pattern>*.jsp</url-pattern>
        <deferred-syntax-allowed-as-literal>true</deferred-syntax-allowed-as-literal>
      </jsp-property-group>
    </jsp-config>

For #2 to be valid, you have to use a Servlet 2.5 XSD.

AFAICT, this does *not* work in Jetty 6.1.x. However, I think this is a bug:

http://tinyurl.com/yr29fg

Matt
DNewfield wrote:
Dale Newfield wrote:
> I've not tried...

And that's the problem right there.  Even just more web research found
an answer:

http://www.devzuz.org/blogs/bporter/2006/08/05/1154706744655.html

clearly answers my question: "But, to escape it with \#{ doesn't work on
Tomcat 5 and other 2.0 containers."

(And I wasn't subscribed to the struts-dev list long enough ago to
notice Musachy's similar workaround suggestion:
http://www.nabble.com/2.1-and-tooltips-tf3535099.html#a9867353 )

-Dale

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

Re: OGNL and JSP 2.1 - are there plans to fix?

by mraible :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


DNewfield wrote:
Dale Newfield wrote:
> I've not tried...

And that's the problem right there.  Even just more web research found
an answer:

http://www.devzuz.org/blogs/bporter/2006/08/05/1154706744655.html

clearly answers my question: "But, to escape it with \#{ doesn't work on
Tomcat 5 and other 2.0 containers."

(And I wasn't subscribed to the struts-dev list long enough ago to
notice Musachy's similar workaround suggestion:
http://www.nabble.com/2.1-and-tooltips-tf3535099.html#a9867353 )

-Dale
It also doesn't work on Jetty 6.1.x, but I think that's a bug in Jetty.

On another note (to quote the article above):

With version 2.1 or later, the character sequence #{ represents a deferred expression, assuming the attribute has been declared to support deferred expressions in the TLD. If the attribute does not support deferred expressions, then the presence of the #{ character sequence results in a translation error.
This seems to imply that if Struts produced a JSP 2.1 TLD for its tags, it could turn off the support of #{} on a per-attribute basis.

Matt

Re: OGNL and JSP 2.1 - are there plans to fix?

by Laurie Harper :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

mraible wrote:

> On another note (to quote the article above):
>
>> With version 2.1 or later, the character sequence #{ represents a deferred
>> expression, assuming the attribute has been declared to support deferred
>> expressions in the TLD. If the attribute does not support deferred
>> expressions, then the presence of the #{ character sequence results in a
>> translation error.
>
> This seems to imply that if Struts produced a JSP 2.1 TLD for its tags, it
> could turn off the support of #{} on a per-attribute basis.

Yes, but that wouldn't help much if it just results in translation errors...

L.


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