You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2006/12/04 22:57:47 UTC

DO NOT REPLY [Bug 41106] New: - "deferred" expression fails if less than 2.0

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=41106>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=41106

           Summary: "deferred" expression fails if <jsp-version> less than
                    2.0
           Product: Tomcat 6
           Version: 6.0.0
          Platform: Other
        OS/Version: other
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Jasper
        AssignedTo: tomcat-dev@jakarta.apache.org
        ReportedBy: stan@jboss.com


Some JSF taglibs such as Ajax4JSF mark the jsp-version tag in the TLD like this:
<jsp-version>1.2</jsp-version>

Then if a developer says something like action="#{foo}" in an Ajax4JSF tag, he
will get this:

This causes Ajax4JSF to fail with this error:
org.apache.jasper.JasperException: /index.jsp(26,4) According to TLD or
attribute directive in tag file, attribute action does not accept any expressions
	org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:40)
	org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:406)
	org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:147)

Jasper tries to check the <jsp-version> in the TLD to see if the version is 2.1
and the attribute is not allowing deferred expressions.  However, pre-2.1, "#{"
had no meaning and was always allowed.

In Validator.java, Jasper has this line:
boolean checkDeferred = !tagInfo.getTagLibrary().getRequiredVersion().equals("2.0");

The problem is that while the logic will work if the TLD says
<jsp-version>2.0</jsp-version>, it won't work for any jsp-version below that.

A better way would be to say something like:
float taglibRequiredVersion =
Float.parseFloat(tagInfo.getTagLibrary().getRequiredVersion());
boolean checkDeferred = taglibRequiredVersion > 2.0f;

I tried this and it works.  However, this is not a complete fix because it
doesn't catch NumberFormatException.

Also, some refactoring might be in order because this same logic is found
elsewhere in Validator.java and also in TagFileDirectiveVisitor.  I'm not sure
if the logic in those two places is correct or not.

I'm attaching a war with a simple tag that demonstrates the problem.

Stan

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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


DO NOT REPLY [Bug 41106] - "deferred" expression fails if less than 2.0

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=41106>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=41106





------- Additional Comments From stan@jboss.com  2006-12-04 16:42 -------
BTW, I suspect that this code in Validator.java is wrong as well (and I don't
mean just the JSP 2.2 comment (-: )

            // JSP.2.2 - '#{' not allowed in template text
            if (n.getType() == '#') {
                if (!pageInfo.isDeferredSyntaxAllowedAsLiteral()
                        && (tagInfo == null 
                                || ((tagInfo != null) &&
!tagInfo.getTagLibrary().getRequiredVersion().equals("2.0")))) {
                    err.jspError(n, "jsp.error.el.template.deferred");
                } else {
                    return;
                }
            }

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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


DO NOT REPLY [Bug 41106] - "deferred" expression fails if less than 2.0

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=41106>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=41106





------- Additional Comments From stan@jboss.com  2006-12-04 14:00 -------
Created an attachment (id=19215)
 --> (http://issues.apache.org/bugzilla/attachment.cgi?id=19215&action=view)
war for testing


-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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


DO NOT REPLY [Bug 41106] - "deferred" expression fails if less than 2.0

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=41106>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=41106





------- Additional Comments From remm@apache.org  2006-12-04 15:27 -------
I am not totally convinced this is really a bug. Maybe. Elsewhere in the class,
there's a check for 1.2 and 2.0, which seems more accurate (and easier).

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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


DO NOT REPLY [Bug 41106] - "deferred" expression fails if less than 2.0

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=41106>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=41106





------- Additional Comments From stan@jboss.com  2006-12-05 06:27 -------
FYI

The old JSF tags processed the EL themselves.  That's the root of the problem. 
So for an Ajax4JSF tag might look like this:

<a4j:commandButton actionListener="#{mybean.action}"/>

The tag would delegate to JSF 1.1 for processing the EL.  This component still
works in JSF 1.2 but now JSF 1.2 delegates back to the EL impl included in JSP
2.1.  So, the old JSF tags need #{mybean.action} to be passed in as a simple
String instead of a MethodExpression or ValueExpression object.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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


DO NOT REPLY [Bug 41106] - "deferred" expression fails if less than 2.0

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=41106>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=41106


remm@apache.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED




------- Additional Comments From remm@apache.org  2006-12-05 05:10 -------
I don't really see what these old tags should do with new pages and EL. Maybe
it's supposed to remain compatible, but it does not make that much sense to me.
It's fixed now.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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


DO NOT REPLY [Bug 41106] - "deferred" expression fails if less than 2.0

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=41106>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=41106





------- Additional Comments From stan@jboss.com  2006-12-04 16:16 -------
You could also say:

boolean checkDeferred = (!version.equals("1.2") && !version.equals("2.0"))

That takes advantage of the fact that 1.2,2.0, and 2.1 are the only versions
where the <jsp-version> tag was defined.  However, doing it that way doesn't
allow someone to say <jsp-version>1.1</jsp-version>.  Maybe it shouldn't be
allowed so you throw an error in that case?

As for it being a bug, I'm quite certain.  An application written for JSP 1.2
should run the same in JSP 2.1.  As of now, that is not true for taglibs with
<jsp-version>1.2</jsp-version>.  Backward compatibility is broken if an
attribute value starts with "#{".  Just try the WAR in Tomcat 5.5 and you will
see that it works.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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