File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes try block is too long Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "try block is too long " Watch "try block is too long " New topic
Author

try block is too long

Mohammed Yousuff
Ranch Hand

Joined: Apr 18, 2006
Posts: 45
Hi

I am using application when I tried to access a JSP page, it displays a compile error throwing that the try block is too long.

When I searched for the cause of the error I came to know there is a limitation in the JSP lines or JSP page size. Is there any other way to compile that page?. I have the instance which is working perfectly in the production server. Please let me know


Regards<br /> <br />Mohammed Yousuff M N <br /> <br />Try NOT to Become a man of SUCCESS, BUT Try to Become a man of VALUE..
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

One way to reduce the number of lines in your JSP is to factor some of the code into JSP include actions (<jsp:include ... />).


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
jiju ka
Ranch Hand

Joined: Oct 12, 2004
Posts: 306

When I searched for the cause of the error I came to know there is a limitation in the JSP lines or JSP page size. Is there any other way to compile that page?


The contents of your jsp are put into a single method. JVM have a limitation for method size and you have crossed this size.

There are couple of ways you can do this
The first and best is to fragment the page into amall pieces and do a dynamic include. This is what Ben Souther is asking and this is the best simple fast solution.

The question is why is your page so big?

Probably you are putting business logic in jsp. Moving the business logic to business layer and do only display logic in jsp.

Probably you have too much of display logic in JSP. Consider using tags.

Probably you have too much of page content. Consider resizing the screens not forcing the user to scroll down or to the right. You can split a screen to mutiple pages and navigate between the pages using next and previous button.

A third solution which is faster but not recommended is in writing methods within a jsp.
ex:
Mohammed Yousuff
Ranch Hand

Joined: Apr 18, 2006
Posts: 45
THANKS A LOT GUYS FOR YOUR COMMENT> ITS WORKING
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: try block is too long