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

  • Generated Jsp is exceeding the 65535 bytes limit


    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/\

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

    org.apache.jasper.compiler.DefaultErrorHandler.jav acError(
    org.apache.jasper.compiler.ErrorDispatcher.javacEr ror(
    org.apache.jasper.compiler.JDTCompiler.generateCla ss(
    org.apache.jasper.servlet.JspServletWrapper.servic e(
    org.apache.jasper.servlet.JspServlet.serviceJspFil e(
    javax.servlet.http.HttpServlet.service(HttpServlet .java:803)
    org.springframework.web.servlet.view.InternalResou rceView.renderMergedOutputModel(InternalResourceVi
    org.springframework.web.servlet.view.AbstractView. render(
    org.springframework.web.servlet.DispatcherServlet. render(
    org.springframework.web.servlet.DispatcherServlet. doDispatch(
    org.springframework.web.servlet.DispatcherServlet. doService(
    org.springframework.web.servlet.FrameworkServlet.p rocessRequest(
    org.springframework.web.servlet.FrameworkServlet.d oGet(
    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!


  • #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.


    • #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.


      • #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" />


        • #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.