Search This Blog

Tuesday 20 August 2013

Unable to compile class for JSP

----------------------------------------------------------------------------------------------------------------------------------------
Aug 20, 2013 9:08:55 AM org.apache.catalina.core.ApplicationDispatcher invoke
SEVERE: Servlet.service() for servlet jsp threw exception
org.apache.jasper.JasperException: Unable to compile class for JSP: 

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

----------------------------------------------------------------------------------------------------------------------------------------

TRY USING : 
<jsp:include page="/html/crm/customer/child.jsp"/>       
INSTEAD OF
<%@ include file="/html/crm/customer/child.jsp"%> 


Actually, if you think about it there is an extra performance hit with every action tag (@include file) .
For eg: say there are two files Child.jsp & Parent.jsp
where, Parent.jsp needs to include Child.jsp

--------------------( /html/.../Parent.jsp )----------------------------------------------------------------------------------
Try 
<jsp:include page="/html/.../Child.jsp"/>  
rather 
<%@include file="/html/.../Child.jsp"%> 
----------------------------------------------------------------------------------------------------------------------------------------
In case facing this Exception(above mentioned). But the only problem is that u need to remove all the dependencies of Parent from Child.
say,  boolean isAdmin= true;  is defined in Parent.jsp but Child.jsp is also being using this value.Otherwise ,in that case you might again get an exception saying : variable isAdmin in Child.jsp cannot be resolved . 

Because , the include directive(<%@include file=""%>) inserts the source of Child.jsp at translation time but the action tag(<jsp:include page=""/>) inserts the response of Child.jsp at runtime.

No comments:

Post a Comment