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 2003/05/07 03:01:45 UTC

DO NOT REPLY [Bug 19713] New: - Invalid inline code generated for nested

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=19713>.
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=19713

Invalid inline code generated for nested <jsp:forward>

           Summary: Invalid inline code generated for nested <jsp:forward>
           Product: Tomcat 5
           Version: 5.0.2
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Jasper2
        AssignedTo: tomcat-dev@jakarta.apache.org
        ReportedBy: hans@gefionsoftware.com


When a <jsp:forward> action with <jsp:param> children is nested within the body
of some other action, the generated inline code can't be compiled. The reason is
that the inline code ends up in a generated method where the "request" variable
is not defined.

Example JSP page:

  <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
  <c:if test="true">
    <jsp:forward page="bar.jsp">
      <jsp:param name="foo" value="bar" />
    </jsp:forward>
  </c:if>

Generates inline code for <jsp:forward> in a method like this:

  private boolean _jspx_meth_c_if_0(PageContext pageContext)
          throws Throwable {
    JspWriter out = pageContext.getOut();
    /* ----  c:if ---- */
    org.apache.taglibs.standard.tag.rt.core.IfTag _jspx_th_c_if_0 =
(org.apache.taglibs.standard.tag.rt.core.IfTag)
_jspx_tagPool_c_if_test.get(org.apache.taglibs.standard.tag.rt.core.IfTag.class);
    _jspx_th_c_if_0.setPageContext(pageContext);
    _jspx_th_c_if_0.setParent(null);
    _jspx_th_c_if_0.setTest(true);
    int _jspx_eval_c_if_0 = _jspx_th_c_if_0.doStartTag();
    if (_jspx_eval_c_if_0 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) {
      do {
        out.write("\r\n  ");
        if (true) {
          pageContext.forward("bar.jsp" + (("bar.jsp").indexOf('?')>0? '&': '?')
+ org.apache.jasper.runtime.JspRuntimeLibrary.URLEncode("foo",
request.getCharacterEncoding())+ "=" +
org.apache.jasper.runtime.JspRuntimeLibrary.URLEncode("bar",
request.getCharacterEncoding()));
          return true;
        }
    ...
    }

The reference to "request", i.e., in "request.getCharacterEncoding()", leads to
compilation errors:

      [javac] Compiling 1 source file
    [javac]
/home/hans/bin/jakarta-tomcat-5.0.2/work/Catalina/localhost/ora/org/apache/jsp/foo_jsp.java:84:
cannot resolve symbol
    [javac] symbol  : variable request 
    [javac] location: class org.apache.jsp.foo_jsp
    [javac]           pageContext.forward("bar.jsp" +
(("bar.jsp").indexOf('?')>0? '&': '?') +
org.apache.jasper.runtime.JspRuntimeLibrary.URLEncode("foo",
request.getCharacterEncoding())+ "=" +
org.apache.jasper.runtime.JspRuntimeLibrary.URLEncode("bar",
request.getCharacterEncoding()));

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