Forums Register Login

performance effect of jsp:include

+Pie Number of slices to send: Send
Hi all,
I have a jsp page of 1000 lines.Now if I split the code and use 50 jsp:include will it effect the performance of the page or its the same say having single page of 1000 lines.
Thanks in advance
Priya
+Pie Number of slices to send: Send
jsp:include is done at runtime.
Does the page need to determine at runtime what page to include?
If not, then use <%@ include file="..." %> instead. This is done at compile time and therefore would have no effect on runtime performance.
[ July 20, 2003: Message edited by: Ron Newman ]
+Pie Number of slices to send: Send
Or... if the majority of those 1000 lines are Java, factor the code out into beans, helpers and custom tags. Your JSP pages are best primarily composed of HTML markup with just enough Java code to perform any display-related code. Anything else is best removed from the page.
hth,
bear
+Pie Number of slices to send: Send
If I have a large amount of java code and move it to custom tags will it have a perfromance improvement? I thought custom tags are a performance penalty which you pay for convenience of using them....
Vasu
+Pie Number of slices to send: Send
It should make very little difference in response time. However, by getting your code out of JSP and into helper classes you will probably find it much easier to optimze the code and to maintain it in the future.
The very idea of maintaining a thousand lines of JSP makes me shudder.
Bill
+Pie Number of slices to send: Send
Sirishree,
Splitting your jsp into 50 jsps and including them in the main jsp is not any different from having a 1000 line JSP as the jsp compiler includes them anyway. Your jsp looks neater. But as pointed out by someone here, you should move all your java code out and make the jsp look like a HTML. Best way to do it is using custom tags. A good side effect of doing it is these custom tags can be reused by your other applications. Using JSTL makes your job of writing custom tags still easier.
Hope this helps.....

Vasu
+Pie Number of slices to send: Send
Hi Priya,
I would go ahead and use @include instead of JSP include. The reason is @include is compile time and is much faster in terms of performance than out dynamic jsp:include. I have programmed on JSPs for the last 3 years and have rarely( saying never wont be an exageration ) come across the scenario where a jsp:include HAS to be used.
Multiple JSP pages ensures cleanliness, but it really is tedious to remember which of those 1000 lines are in which page.
If the scenario demands go ahead and use @include.
For development and testing u can use jsp:include. Hoever when sending the war/ear to the client make sure u change the tags to @include. I do this because if u use @include at the time of development/testing u have to keep clearing the cache, a tedious task, aint it.
sunglasses are a type of coolness prosthetic. Check out the sunglasses on this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 1932 times.
Similar Threads
Problem with jsp:include
JSP:INCLUDE Question?
jsp include
Custom tags to override jsp include action and @include directive
communication between two webapps which are in the same server
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 09:30:20.