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

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=14699

Scripting variables declared AT_END do not work when tag implements TryCatchFinally.

           Summary: Scripting variables declared AT_END do not work when tag
                    implements TryCatchFinally.
           Product: Tomcat 4
           Version: 4.1.12
          Platform: PC
        OS/Version: Windows NT/2K
            Status: NEW
          Severity: Critical
          Priority: Other
         Component: Jasper 2
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


Scripting variables declared within tag implementing TryCatchFinally interface
are positioned inside try block in the generated code thus hiding their
visibility to rest of the page.

Example (foo.tld not included):

test.jsp:
<%@taglib uri="foo" prefix="foo" %>

<foo:foo>
</foo:foo>

<%= test %>

FooTag.java:
package foo;

import javax.servlet.jsp.tagext.*;

public class FooTag extends BodyTagSupport implements TryCatchFinally {
        
        public int doEndTag() {
                pageContext.setAttribute("test", "testValue");
                return EVAL_PAGE;
        }
        
        public void doCatch(Throwable exc) {
        }
        
        public void doFinally() {
        }
}

FooTEI.java:
package foo;

import javax.servlet.jsp.tagext.*;

public class FooTEI extends TagExtraInfo {
        private static final String DEFAULT_VAR_NAME = "test";
        
    public VariableInfo[] getVariableInfo(TagData tagData) {
        String varName = null;
        VariableInfo varInfo = new VariableInfo(
            (varName==null?DEFAULT_VAR_NAME:varName), 
            "java.lang.String", true, 
            VariableInfo.AT_END);
        return new VariableInfo[] {varInfo};
    }
}

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

An error occurred at line: 5 in the jsp file: /test.jsp

Generated servlet error:
    [javac] Compiling 1 source file

C:\Server\Tomcat4.1\work\Standalone\localhost\_\test_jsp.java:86: cannot resolve
symbol
symbol  : variable test 
location: class org.apache.jsp.test_jsp
      out.print( test );
                 ^
1 error

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to