File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes How to get faster page loads 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 » Frameworks » Struts
Bookmark "How to get faster page loads" Watch "How to get faster page loads" New topic
Author

How to get faster page loads

Maya Thomas
Greenhorn

Joined: Mar 10, 2008
Posts: 3
I have noticed that it takes a long time for the pages in my app to load the first time. The action class executes quickly and it takes at least 6 to 10 seconds to render the page after that. I am using struts and jstl tags (struts 1.2.9) and no custom tags.

My application uses tiles. And each tile in a jsp imports struts/jstl tag libraries. Each jsp page has about 4 to 5 tiles. I understand that the first time the page is called, it is compiled. But isn't 10 seconds long for displaying a page?


Is it the taglib imports in each tile that is slowing down the process? Is there anyway i could import the taglibs only once instead of calling them for each tile in the layout?

Thanks
rajan Kayarohanam
Greenhorn

Joined: Jan 24, 2008
Posts: 12
Hi Maya Thomas,

I've done few R&D in this and finally i came to conclusion that these problems are due to JSP's.

While you Build the Application the JSP's will generate class files for all the JSP's. Check the EAR/WAR file for the Class files of all the JSP's and then Deploy the application.

The Reason : After the Application is deployed in Prod/Pilot Server when you try to click on some JSP, the Jsp will actually try to create a class file for the same and because of that it takes time to load. so instead you create the Class files even before Deploying the EAR/WAR file in Server.

Steps in RAD to create the Class Files in JSP:
1. Right the Web Project under the Dynamic Projects for "Properties", here there is a option called "JSP Compilation".
By Default the "when Server Displays page" options will be chosen, Change the option to "when project is built in workspace" and chek the checkbox.
This will lead you to create the Class files of JSP's.

Regards,
KMR
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42267
    
  64
The original post doesn't contain enough information to conclude that the problem is due to JSPs. It could just as well be that the application logic or database access is taking a while. The first step in diagnosing this would be to determine what is taking up how much time. Then one can start addressing it.
[ March 11, 2008: Message edited by: Ulf Dittmer ]

Ping & DNS - my free Android networking tools app
Maya Thomas
Greenhorn

Joined: Mar 10, 2008
Posts: 3
Ulf,
I came to the conclusion that the problem is with the JSP is because the first time page load is always slow and the subsequent calls are fast.

Rajan,
Forgive my ignorance, but is RAD your appliction server or something like ant?
Brent Sterling
Ranch Hand

Joined: Feb 08, 2006
Posts: 948
A 10 second lag sounds about right for the time required to translate your JSP into Java code and then compile the generated Java code. Most application servers have a way to precompile your JSP files so that user's do not see this delay.

- Brent
rajan Kayarohanam
Greenhorn

Joined: Jan 24, 2008
Posts: 12
Maya,

RAD - IBM Rational Application Developer, its an IDE for developing Applications.
IBM Rational Application Developer (RAD) is the new generation of Java application development environments built on the Eclipse open platform.

The Steps which i gave is to do the Pre-Compilation of JSPs in RAD IDE.
For More info:
Info on RAD

what is the IDE you are using to develop your application?
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: How to get faster page loads