Im new to jsp.I\'m getting error is The code of method _jspService(HttpServletRequest, HttpServletResponse) is exceeding the 65535 bytes limit
I am using s
We "fixed" this here by setting mappedfile
to false
for JspServlet in our Tomcat-Config.
Go to %TOMCAT_HOME%/conf/web.xml
and add the following init-param to the JspServlet:
<init-param>
<param-name>mappedfile</param-name>
<param-value>false</param-value>
</init-param>
This does not solve the 64 KiB limit but helps in that way that it occurs much later because the generated code is shorter then.
When you run Jsp, by default it converts into java code. And in Java, only 65K code can be accommodated inside an single try catch loop. So don't put much code in a single jsp, instead you can import the number of Jsp files into an single jsp file. or else use JSTL.
I have been having this problem since yesterday, I split my JSP into two JSPs using dynamic include <jsp:include
,but it alone didn't help me, Make sure you also add all tags lib and import statement. <jsp:include
works like a function, So if you are breaking up your JSP in two or more they require same import which you have in your original JSP. Hope it works for you, it worked for me.
In case anyone else stumbles on this, in my case, it was just a JSP with multiple include statements of other JSP files (and some of them more than once), so just checking that everything was included once solved the problem.
Rather making multiple files i found above mentioned answer's solution more good i-e Adding
<init-param>
<param-name>mappedfile</param-name>
<param-value>false</param-value>
</init-param>
into Web.XML file. but i did not found "JspServlet" in my web.XML file and found a ref link and placed the complete mapping
<servlet>
<servlet-name>jsp</servlet-name>
<servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class>
<init-param>
<param-name>mappedfile</param-name>
<param-value>false</param-value>
</init-param>
</servlet>
that worked for me. hope this will help someone.
Move some of the logic out of your JSP pages and into dedicated beans.
The limit of 65k bytes per Java method is insanely high and only very, very long methods exceed it.
Note also that the length of any strong constants is not included in that method, so you simply have some absurd amount of logic in that single method (note: JSPs are compiled into Servlets, wher the _jspService
method holds the main bulk of the content of the JSP).
So you simply have too much logic. You shouldn't have any logic in your JSP at all (only output rendering).
Also note that <%@ include
and <jsp:include
are simply two different ways to do the same thing in this case, so that won't make a difference.