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: [EMAIL PROTECTED]


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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to