Meaningless Drivel is fun!
The moose likes JSP and the fly likes Getting too large try statement in  JSP page Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Getting too large try statement in  JSP page" Watch "Getting too large try statement in  JSP page" New topic

Getting too large try statement in JSP page

jai KM

Joined: Aug 22, 2005
Posts: 1

i getting code too large for try statement, when i opening one of my JSP file. File size is around 2000 lines.
Could anybody tell me the reason for that error. is it because of the restriction in java compiler?.
if u have any alternatives let me know...

thanks in advance...

Daniel Rhoades
Ranch Hand

Joined: Jun 30, 2004
Posts: 186
2000 lines of code in 1 file is obscene!

Separate you code into logical function and put them into other JSP pages - or better yet servlets or tag libraries.

Drinking more tea is the key...
Chetan Parekh
Ranch Hand

Joined: Sep 16, 2004
Posts: 3640
If you are not in a position to modularize 2000 line code, try to cover up your existing code with multiple try/catch block.

My blood is tested +ve for Java.
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63838

"jai KM",

There aren't many rules that you need to worry about here on the Ranch, but one that we take very seriously regards the use of proper names. Please take a look at the JavaRanch Naming Policy and adjust your display name to match it.

In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.

Forum Bartender

[Asking smart questions] [About Bear] [Books by Bear]
Ajay Krihnamurthy

Joined: Aug 24, 2005
Posts: 8
hi 2000 lines is not a big issue in a jsp page. U can do onething use multipe try{}catch(Exception e){System.out.println(e.getMessage());} with inur jsp code .. From the tomcats log folder u can get the appropriate error message for ur exception

once if u cant sove that error please let me know

hi.. java is not a product it is an Industry
Choon-Chern Lim
Ranch Hand

Joined: Aug 29, 2005
Posts: 74
2000 lines in JSP is not the problem, but it will be a massive problem once you get exceptions. In my past experience, it is difficult to debug the code.

I would suggest you breaking up the codes, where you place your JAVA codes in servlets, your presentations (HTML/JSP tags stuff) in JSP, and your client side script (Javascript) in JS file. At least, when other developer reads your codes, they are not going to get lost in the sea of codes.

Another beauty of having your codes in servlets is that you can easily debug your codes by putting break points in IDEs like Eclipse/WSAD/RAD.

I guess my point is that you want to be able to able to read your own codes in 3 months time.
I agree. Here's the link:
subject: Getting too large try statement in JSP page
jQuery in Action, 3rd edition