While working on a rather large JSP with Java and Tomcat, you may have Jasper sooner or later raise the "code too large for try statement" error.
This happens if your JSP contains a lot of code, especially Java code (incapsulated in the <% %> tags) or very very long comments.
In fact, before being presented as an HTML page, the JSP is compiled and in the process, it is enclosed in a try-catch statement which, like any method, has a maximum bytecode size of 64KB (65535 bytes).
The only way to avoid this issue is to split the JSP into multiple pages and then include them using the:
<jsp:include page="file.jsp"/>
directive which compiles the page BEFORE including it instead of:
<% @include file="file.jsp" %>
which embeds the page "as is"
No comments:
Post a Comment
With great power comes great responsibility