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 2002/11/20 09:49:53 UTC

DO NOT REPLY [Bug 14699] New: - Scripting variables declared AT_END do not work when tag implements TryCatchFinally.

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: tomcat-dev@jakarta.apache.org
        ReportedBy: sami.pajunen@almare.com


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:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>