On Tue, 28 Aug 2001, Jin Yu wrote:

> Date: Tue, 28 Aug 2001 10:24:24 -0400
> From: Jin Yu <[EMAIL PROTECTED]>
> Reply-To: [EMAIL PROTECTED]
> To: "'[EMAIL PROTECTED]'" <[EMAIL PROTECTED]>
> Subject: Bug in tag lib implementation
>
> Hi,
>
> According to my interpretation of the JSP 1.1 spec, the following code
> should be legal.  I've changed the name of the tag from "foo" to "foo.test".
> Page 99 of the spec states that name can be any NMTOKEN.  Since "foo.test"
> is a NMTOKEN it should be a legal name.  I think this is the same as bug
> #3019.  I've tested this on Tomcat 3.2.3, 3.3, and 4.0b7.  They all throw
> exception similiar to the one below.  It appears that the problem is that
> the tag name is concatenated with some other text to created varible names
> in the generated JSP without checking the name for illegal variable name
> characters and replacing them.
>
>
> Is my interpretation of the spec correct?
>

I believe so.  This is an implementation issue in all versions of Jasper.

> Has this problem been fixed already?
>

Not yet.

> How can I submit a fix to the problem that my co-worker has come up with?
>

The best general approach is to submit a bug report to
<http://nagoya.apache.org/bugzilla> and attach your fix as an attachment.


> What version of tomcat will such a fix be accepted for?
>

If I'm understanding you correctly, this is already reported against
Tomcat 4.0 as Bugzilla #3019.  A proposed fix would accellerate this
getting addressed for this version.


> Thanks,
> Jin
>

Craig McClanahan

> -------------------updated example-taglib.tld --------------------
>   <!-- A simple Tag -->
>   <!-- foo tag -->
>   <tag>
>     <name>foo.test</name>
>     <tagclass>examples.FooTag</tagclass>
>     <teiclass>examples.FooTagExtraInfo</teiclass>
>     <bodycontent>JSP</bodycontent>
>     <info>
>       Perform a server side action; uses 3 mandatory attributes
>     </info>
>
>
> ------------- updated foo.jsp from examples ------------------
> <html>
> <!--
>       Copyright (c) 1999 The Apache Software Foundation.  All rights
>       reserved.
> -->
> <body>
> <%@ taglib uri="http://java.apache.org/tomcat/examples-taglib"; prefix="eg"
> %>
>
> Radio stations that rock:
>
> <ul>
> <eg:foo.test att1="98.5" att2="92.3" att3="107.7">
> <li><%= member %></li>
> </eg:foo.test>
> </ul>
>
>
> ----------------- exception seen in the browser ----------
>
> Error: 500
> Location: /examples/jsp/simpletag/foo.jsp
> Internal Servlet Error:
>
> org.apache.jasper.JasperException: Unable to compile class for
> JSPD:\Java\Tomcat\jakarta-tomcat-3.2.3\work\localhost_8080%2Fexamples\_0002f
> jsp_0002fsimpletag_0002ffoo_0002ejspfoo_jsp_0.java:65: Invalid declaration.
>                 examples.FooTag _jspx_th_eg_foo.test_0 = new
> examples.FooTag();
>                                                ^
> D:\Java\Tomcat\jakarta-tomcat-3.2.3\work\localhost_8080%2Fexamples\_0002fjsp
> _0002fsimpletag_0002ffoo_0002ejspfoo_jsp_0.java:66: Undefined variable,
> class, or package name: _jspx_th_eg_foo
>                 _jspx_th_eg_foo.test_0.setPageContext(pageContext);
>                 ^
> D:\Java\Tomcat\jakarta-tomcat-3.2.3\work\localhost_8080%2Fexamples\_0002fjsp
> _0002fsimpletag_0002ffoo_0002ejspfoo_jsp_0.java:67: Undefined variable,
> class, or package name: _jspx_th_eg_foo
>                 _jspx_th_eg_foo.test_0.setParent(null);
>                 ^
> D:\Java\Tomcat\jakarta-tomcat-3.2.3\work\localhost_8080%2Fexamples\_0002fjsp
> _0002fsimpletag_0002ffoo_0002ejspfoo_jsp_0.java:68: Undefined variable,
> class, or package name: _jspx_th_eg_foo
>                 _jspx_th_eg_foo.test_0.setAtt1("98.5");
>                 ^
> D:\Java\Tomcat\jakarta-tomcat-3.2.3\work\localhost_8080%2Fexamples\_0002fjsp
> _0002fsimpletag_0002ffoo_0002ejspfoo_jsp_0.java:69: Undefined variable,
> class, or package name: _jspx_th_eg_foo
>                 _jspx_th_eg_foo.test_0.setAtt2("92.3");
>                 ^
> D:\Java\Tomcat\jakarta-tomcat-3.2.3\work\localhost_8080%2Fexamples\_0002fjsp
> _0002fsimpletag_0002ffoo_0002ejspfoo_jsp_0.java:70: Undefined variable,
> class, or package name: _jspx_th_eg_foo
>                 _jspx_th_eg_foo.test_0.setAtt3("107.7");
>                 ^
> D:\Java\Tomcat\jakarta-tomcat-3.2.3\work\localhost_8080%2Fexamples\_0002fjsp
> _0002fsimpletag_0002ffoo_0002ejspfoo_jsp_0.java:72: Invalid declaration.
>                     int _jspx_eval_eg_foo.test_0 =
> _jspx_th_eg_foo.test_0.doStartTag();
>                                          ^
> D:\Java\Tomcat\jakarta-tomcat-3.2.3\work\localhost_8080%2Fexamples\_0002fjsp
> _0002fsimpletag_0002ffoo_0002ejspfoo_jsp_0.java:73: Undefined variable or
> class name: _jspx_eval_eg_foo
>                     if (_jspx_eval_eg_foo.test_0 == Tag.EVAL_BODY_INCLUDE)
>                         ^
> D:\Java\Tomcat\jakarta-tomcat-3.2.3\work\localhost_8080%2Fexamples\_0002fjsp
> _0002fsimpletag_0002ffoo_0002ejspfoo_jsp_0.java:75: Undefined variable or
> class name: _jspx_eval_eg_foo
>                     if (_jspx_eval_eg_foo.test_0 != Tag.SKIP_BODY) {
>                         ^
> D:\Java\Tomcat\jakarta-tomcat-3.2.3\work\localhost_8080%2Fexamples\_0002fjsp
> _0002fsimpletag_0002ffoo_0002ejspfoo_jsp_0.java:77: Undefined variable or
> class name: _jspx_eval_eg_foo
>                             if (_jspx_eval_eg_foo.test_0 !=
> Tag.EVAL_BODY_INCLUDE) {
>                                 ^
> D:\Java\Tomcat\jakarta-tomcat-3.2.3\work\localhost_8080%2Fexamples\_0002fjsp
> _0002fsimpletag_0002ffoo_0002ejspfoo_jsp_0.java:79: Undefined variable,
> class, or package name: _jspx_th_eg_foo
>
> _jspx_th_eg_foo.test_0.setBodyContent((BodyContent) out);
>                               ^
> D:\Java\Tomcat\jakarta-tomcat-3.2.3\work\localhost_8080%2Fexamples\_0002fjsp
> _0002fsimpletag_0002ffoo_0002ejspfoo_jsp_0.java:81: Undefined variable,
> class, or package name: _jspx_th_eg_foo
>                           _jspx_th_eg_foo.test_0.doInitBody();
>                           ^
> D:\Java\Tomcat\jakarta-tomcat-3.2.3\work\localhost_8080%2Fexamples\_0002fjsp
> _0002fsimpletag_0002ffoo_0002ejspfoo_jsp_0.java:96: Undefined variable,
> class, or package name: _jspx_th_eg_foo
>                           } while (_jspx_th_eg_foo.test_0.doAfterBody() ==
> BodyTag.EVAL_BODY_TAG);
>                                    ^
> D:\Java\Tomcat\jakarta-tomcat-3.2.3\work\localhost_8080%2Fexamples\_0002fjsp
> _0002fsimpletag_0002ffoo_0002ejspfoo_jsp_0.java:98: Undefined variable or
> class name: _jspx_eval_eg_foo
>                           if (_jspx_eval_eg_foo.test_0 !=
> Tag.EVAL_BODY_INCLUDE)
>                               ^
> D:\Java\Tomcat\jakarta-tomcat-3.2.3\work\localhost_8080%2Fexamples\_0002fjsp
> _0002fsimpletag_0002ffoo_0002ejspfoo_jsp_0.java:102: Undefined variable,
> class, or package name: _jspx_th_eg_foo
>                   if (_jspx_th_eg_foo.test_0.doEndTag() == Tag.SKIP_PAGE)
>                       ^
> D:\Java\Tomcat\jakarta-tomcat-3.2.3\work\localhost_8080%2Fexamples\_0002fjsp
> _0002fsimpletag_0002ffoo_0002ejspfoo_jsp_0.java:105: Undefined variable,
> class, or package name: _jspx_th_eg_foo
>                   _jspx_th_eg_foo.test_0.release();
>                   ^
> 16 errors
>
>       at org.apache.jasper.compiler.Compiler.compile(Compiler.java:282)
>       at
> org.apache.jasper.servlet.JspServlet.doLoadJSP(JspServlet.java:612)
>       at
> org.apache.jasper.servlet.JasperLoader12.loadJSP(JasperLoader12.java:146)
>       at org.apache.jasper.servlet.JspServlet.loadJSP(JspServlet.java:542)
>       at
> org.apache.jasper.servlet.JspServlet$JspServletWrapper.loadIfNecessary(JspSe
> rvlet.java:258)
>       at
> org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.ja
> va:268)
>       at
> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:429)
>       at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:500)
>       at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
>       at
> org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:405)
>       at org.apache.tomcat.core.Handler.service(Handler.java:287)
>       at
> org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
>       at
> org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:81
> 2)
>       at
> org.apache.tomcat.core.ContextManager.service(ContextManager.java:758)
>       at
> org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpC
> onnectionHandler.java:213)
>       at
> org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
>       at
> org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:501)
>       at java.lang.Thread.run(Thread.java:484)
> Enterprise Channel Management Software for Manufacturers
> Visit us at http://www.ultryx.com
>
>

Reply via email to