The code of method _jspService(HttpServletRequest, HttpServletResponse) is exceeding the 65535 bytes limit

如果你是通过搜索来到本文的,相信你应该是遇到了如下的错误
The code of method _jspService(HttpServletRequest, HttpServletResponse) is exceeding the 65535 bytes limit
这个错误是因为JSP文件太大了导致的。
如果是纯粹的Tomcat,找到Tomcat安装目录下conf文件夹下的web.xml文件,在如下位置,添加红色字体的参数。
(D:\Program Files\Apache Software Foundation\Tomcat 6.0\conf\web.xml)
<servlet>
<servlet-name>jsp</servlet-name>
<servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class>
<init-param>
<param-name>fork</param-name>
<param-value>false</param-value>
</init-param>
<init-param>
<param-name>xpoweredBy</param-name>
<param-value>false</param-value>
</init-param>
        <init-param>
            <param-name>mappedfile</param-name>
            <param-value>false</param-value>
        </init-param>
<load-on-startup>3</load-on-startup>
</servlet>
重启Tomcat,问题基本解决。
为什么说基本解决呢,因为
1、这样做,只是让Tomcat不为JSP每行都添加print语句,但是实际上,当文件达到一定程度,还是会发生错误,所以最根本的还是尽量减小JSP大小。
TIP:mappedfile : 是否对每个输入行都用一条print语句来生成静态内容,以方便调试。缺省为true。

摘自:https://harde.org/blog/2013/06/how-to-fix-the-code-of-method-is-exceeding-the-65535-bytes-limit.html

你可能感兴趣的:(The code of method _jspService(HttpServletRequest, HttpServletResponse) is exceeding the 65535 bytes limit)