• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

try block is too long

 
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
One way to reduce the number of lines in your JSP is to factor some of the code into JSP include actions (<jsp:include ... />).
 
Ranch Hand
Posts: 308
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


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
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
THANKS A LOT GUYS FOR YOUR COMMENT> ITS WORKING
 
Yeah, but does being a ninja come with a dental plan? And what about this tiny ad?
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic