In our Application, there is a very complex HTML page to be rendered. The JSP sends out 13000 odd lines of HTML to the browser. There is lots of Java looping involved in the JSP. We found from our logs that the JSP takes approximately 40 secs to finish execution. The App is running in our Client's Intranet. We have access to that intranet and the link is pretty fast.
Instead of generating the HTML in loops, I appended a good chunk of the HTML in a StringBufer object and sent it to to the Browser in one go by <%=objStringBuffer.toString()%>. But the page now took more time to my dismay.
The comment I'm about to make is not really a JSP issue and you may want to take it to the perfomance thread...
StringBuffer, if not used properly can actually be more expensive than string concatenation. According to "Harcore Java" (can't remember the author's name), if you use the concatenation operator inside the argument params to the append method, a new StringBuffer object has to be created.
Accourding to this book, it is much more efficient to make a separate call to the append method for every addition to the buffer.