Announcement Announcement Module
Collapse
No announcement yet.
Generated Jsp is exceeding the 65535 bytes limit Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Generated Jsp is exceeding the 65535 bytes limit

    Hi,

    I am using the form tag like this:

    <form:select path="weight" cssErrorClass="olanerr" cssClass="txt"><form:option value="0"><spring:message code="common.undefined"/></form:option>

    <form:option value="1"><spring:message code="create.weight.1"/></form:option>

    <form:option value="40">40kg</form:option>
    .
    .
    .
    .

    There are over 100 option subelements in form:select tag. I am getting always the following error:


    org.apache.jasper.JasperException: Unable to compile class for JSP:
    JSP FileName:null
    Java FileName:/C:/_development/workspace/AvrupaSingle.com/3rdparty/apache-tomcat-5.5.25/../../../work//org/apache/jsp/WEB_002dINF/jsp/create\index_jsp.java


    An error occurred at line: 70 in the generated java file
    The code of method _jspService(HttpServletRequest, HttpServletResponse) is exceeding the 65535 bytes limit

    Stacktrace:
    org.apache.jasper.compiler.DefaultErrorHandler.jav acError(DefaultErrorHandler.java:98)
    org.apache.jasper.compiler.ErrorDispatcher.javacEr ror(ErrorDispatcher.java:330)
    org.apache.jasper.compiler.JDTCompiler.generateCla ss(JDTCompiler.java:435)
    org.apache.jasper.compiler.Compiler.compile(Compil er.java:298)
    org.apache.jasper.compiler.Compiler.compile(Compil er.java:277)
    org.apache.jasper.compiler.Compiler.compile(Compil er.java:265)
    org.apache.jasper.JspCompilationContext.compile(Js pCompilationContext.java:564)
    org.apache.jasper.servlet.JspServletWrapper.servic e(JspServletWrapper.java:302)
    org.apache.jasper.servlet.JspServlet.serviceJspFil e(JspServlet.java:329)
    org.apache.jasper.servlet.JspServlet.service(JspSe rvlet.java:265)
    javax.servlet.http.HttpServlet.service(HttpServlet .java:803)
    org.springframework.web.servlet.view.InternalResou rceView.renderMergedOutputModel(InternalResourceVi ew.java:167)
    org.springframework.web.servlet.view.AbstractView. render(AbstractView.java:239)
    org.springframework.web.servlet.DispatcherServlet. render(DispatcherServlet.java:1158)
    org.springframework.web.servlet.DispatcherServlet. doDispatch(DispatcherServlet.java:900)
    org.springframework.web.servlet.DispatcherServlet. doService(DispatcherServlet.java:808)
    org.springframework.web.servlet.FrameworkServlet.p rocessRequest(FrameworkServlet.java:476)
    org.springframework.web.servlet.FrameworkServlet.d oGet(FrameworkServlet.java:431)
    javax.servlet.http.HttpServlet.service(HttpServlet .java:690)
    javax.servlet.http.HttpServlet.service(HttpServlet .java:803)



    The generated jsp file is very long due to form tag insertions. Is there a workaround for this problem. It must be possible to use form:option tag without this limitation!

    THanks.

  • #2
    Use the for Luke...

    Your error is obvious: a Java class method may not exceed 65KB, and JSPs are compiled to a Java class containing a service(...) method that implements the JSP.

    So the solution to your problem is very simple: do not copy-paste tons of code. Use cycles.

    Comment


    • #3
      In your java code put the 100 entries in an ArrayList then in your jsp use <c:foreach> to loop over it and produce the option elements.

      Comment


      • #4
        As far as I remember there is a 65K limitation in the amount of code can be put inside a single try - catch block. This limitation is reached usually JSP-servlet compilation. Some servers allows you to bypass this problem by setting some server based settings but I think this is not the best solution.

        Simplest way is to avoid these problems is to use JSTL (for or forEach loops etc) just like Lachezar and lumpynose described. See also the Spring formtags.

        In really big JSP pages you can share the JSP code in multiple JSP files and import them: <jsp:include page="/WEB-INF/views/yourJspPage.jsp" />

        Comment


        • #5
          Same page is running in other m/c

          Same page is running in other m/c.How is it possible that 65k is limit for me nad not for other m/c.FYI other m/c are using same config and server and jdk version as mine plz reply fast its urgent and I am stuck.

          Comment

          Working...
          X