File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSP and the fly likes Large JSP Files Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Large JSP Files" Watch "Large JSP Files" New topic

Large JSP Files

Kash Mhai

Joined: Apr 01, 2005
Posts: 29
Hello everyone,
The app that i am building has some very large JSPs. Something to the tune of 100kb (JSP). when the page is accessed for the first time, the java file that is generated is at 700KB and the subsequent class file is around 110 KB. The subsequent hits to the page are pretty fast. But the first hit is taking a lot of time. Is there a way in which I can reduce the response time in the first hit? I have done the following and have also inferred the following -
1. The buffer size is set to 150KB with autoflush set to true.
2. Am using gzip compression to compress the data.
3. I have tracked each step of the process and i have come to the conclusion that the conversion to the .java and to subsequent .class is what is taking a long time, and NOT the actual execution.
4. I do know there is an option of pre-compiling the JSPs but am looking for options beyond this.

The server is WAS 5 and JDK is 1.4 with JSP 2.0. Am using Struts 1.3 (!!?) in the app.

Can anybody help? It could be in the form of tweaking the app server or a change in the code, any suggestions is appreciated.


-------------<br />There are wheels within wheels...<br />P.G Wodehouse
Chetan Parekh
Ranch Hand

Joined: Sep 16, 2004
Posts: 3640
Are you firing any queries too in this JSP? If, yes, can they be optimized?

Now for the size of JSP:
Have a look at the code of the JSP and figure out if you can modularize the task that is being done by JSP. Put some tasks in bean/class/tags and call them in JSP.

Using Servlet is also an alternative, as your can load Servlet on the start-up.

My blood is tested +ve for Java.
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
The queries are not fired in the JSP. And the after the whole modularization, this is the filesize. Is the size of the class file generated connected to the buffer size in any way?.. I wonder!

I agree. Here's the link:
subject: Large JSP Files
It's not a secret anymore!