I am getting 'Branch too large' exception when I am trying to run my JSP. I figured out that there is some problem with the size of my JSP and basically the service() method of the generated servlet class file is overshooting the java method limit.
Any tips and/or pointers on gettin rid of this problem ?
Break your logic down into smaller chunks. In the short run, change some of your JSP logic to includes and method calls (you can define a Java method in a JSP in a declaration scriptlet). In the long run, make greater use of advanced techniques like custom tags.
I have managed to make this JSP work by breaking the JSP into 2 and using <jsp:include> tag. Thanks. However, will custom tags work ? Coz I thought it will just add up to the same servlet's _jspService() method and I will land up at the same error again isnt it ?
Custom tags may or may not work, depending on how they are used. You probably won't have problems with custom tags somehow "merging" the included page, since that isn't how custom tags work.
Here are the problems you might have:
First off, you will have to import the taglib in both pages (that's easy enough).
Second, your taglib may store data with page scope (in the PageContext). Page scope data will not carry from one page to the next.
To solve this problem:
A) Organize your included pages around the data they use, so that you do not need to share data between pages.
B) If you must share data, put it in the request or session scopes, which will carry from one included page to the next.
There is a 'method limit' in Java? Can you expalin this?