2 Replies Latest reply on Jun 21, 2006 3:44 PM by sjwhyter

    JSP Compile Errors with jsp:includes with JDK 1.5

      I have read the wiki on compiling JSP with JDK 1.5, and this works for most pages, but I am still getting errors when the pages have jsp:includes in them, the error seems to point to not being able to find variable apache.


      An error occurred at line: 555 in the jsp file: /jsp/examMaster/ExamMaster.jsp
      Generated servlet error:
      /opt/JBossJEMS/jboss-4.0.4.GA-src/build/output/jboss-4.0.4.GA/server/default/work/jboss.web/localhost/admin/org/apache/jsp/jsp/examMaster/ExamMaster_jsp.java:663: cannot find symbol
      symbol : variable apache
      location: class com.mycompany.domain.Organization
      org.apache.jasper.runtime.JspRuntimeLibrary.include(request, response, "ExamCodeAddEdit.jsp" + (("ExamCodeAddEdit.jsp").indexOf('?')>0? '&': '?') + org.apache.jasper.runtime.JspRuntimeLibrary.URLEncode("mode", request.getCharacterEncoding())+ "=" + org.apache.jasper.runtime.JspRuntimeLibrary.URLEncode(String.valueOf( pageAction ), request.getCharacterEncoding()) + "&" + org.apache.jasper.runtime.JspRuntimeLibrary.URLEncode("showBypass", request.getCharacterEncoding())+ "=" + org.apache.jasper.runtime.JspRuntimeLibrary.URLEncode(String.valueOf( showBypass ), request.getCharacterEncoding()), out, true);

        • 1. Re: JSP Compile Errors with jsp:includes with JDK 1.5

          I also wanted to point out that I am not using any 1.5 syntax, just compiling with the following in the web.xml:


          <servlet-name>jsp</servlet-name>
          <servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class>

          <init-param>
          <param-name>compiler</param-name>
          <param-value>modern</param-value>
          </init-param>

          <init-param>
          <param-name>fork</param-name>
          <param-value>true</param-value>
          </init-param>
          <init-param>
          <param-name>xpoweredBy</param-name>
          <param-value>false</param-value>
          </init-param>


          <!-- Uncomment to use jdk1.5 features in jsp pages -->
          <init-param>
          <param-name>compilerSourceVM</param-name>
          <param-value>1.5</param-value>
          </init-param>

          <init-param>
          <param-name>compilerTargetVM</param-name>
          <param-value>1.5</param-value>
          </init-param>


          <!-- Use a custom options class to allow the shared tag lib descriptors
          to be loaded from jars in the tomcat sar conf/tlds directory. The
          standard options implementation can only find taglibs based on the
          class loader classpath.
          -->
          <init-param>
          <param-name>engineOptionsClass</param-name>
          <param-value>org.jboss.web.tomcat.tc5.jasper.JspServletOptions</param-value>
          </init-param>
          <!-- Specify the jars relative to the jbossweb-tomcat55.sar that should
          be scanned for common tag lib descriptors to include in every war
          deployment.
          -->
          <init-param>
          MyFaces tlds
          <param-name>tagLibJar0</param-name>
          <param-value>jsf-libs/myfaces-impl.jar</param-value>
          </init-param>

          <load-on-startup>3</load-on-startup>

          • 2. Re: JSP Compile Errors with jsp:includes with JDK 1.5

            I figured it out. I don't know if this is a bug with Tomcat or not. In the jsp I have a Organization class instance called org:

            Organization org = (Organization) s.getAttribute(Application.SO_ADMIN_ORG);

            and in the jsp I have the following jsp:include:

             Select a School:
             <jsp:include page="../common/SelectOrganization.jsp" flush="true">
             <jsp:param name="value" value="<%= selectedFacilityId %>"/>
             <jsp:param name="applications" value="<%= Application.CORE_RADWEB %>"/>
             </jsp:include>
            
             <input type="submit" id="btSelect" name="btSubmit" value="Select" class="button" title="Click to view selected schools exam codes."/>



            When this is converted to a servlet, the code that is generated is as follows:

            <td >\n");
             out.write("\t Select a Facility:\n");
             out.write("\t ");
             org.apache.jasper.runtime.JspRuntimeLibrary.include(request, response, "../common/SelectOrganization.jsp" + (("../common/SelectOrganization.jsp").indexOf('?')>0? '&': '?') + org.apache.jasper.runtime.JspRuntimeLibrary.URLEncode("value", request.getCharacterEncoding())+ "=" + org.apache.jasper.runtime.JspRuntimeLibrary.URLEncode(String.valueOf( selectedFacilityId ), request.getCharacterEncoding()) + "&" + org.apache.jasper.runtime.JspRuntimeLibrary.URLEncode("applications", request.getCharacterEncoding())+ "=" + org.apache.jasper.runtime.JspRuntimeLibrary.URLEncode(String.valueOf( Application.CORE_RADWEB ), request.getCharacterEncoding()), out, true);
             out.write("\n");
             out.write("\t \n");
             out.write("\t <input type=\"submit\" id=\"btSelect\" name=\"btSubmit\" value=\"Select\" class=\"button\" title=\"Click to view selected facility's exam codes.\"/>\n");
             out.write("\t </td>\n");


            When the compiler sees the org.apache.jasper.JspRuntimeLibrary declaration it gives a compile error saying it can not resolve variable apache. It assumes that apache is a variable in the Organization class.

            This worked fine in a earlier version of Tomcat, is this a bug in the jasper tools?