Karthik
Karthik

Reputation: 11

JSTL tags performance issues

I am using so many JSTL tags in single JSP page. I want to know if any performance issues occur due to that. How about the Page Rendering Time in the particular page? The server side code executes quickly. However the time taken to render the entire page once the rendering of the page starts seems to take a lot of time. Is there a performance issue if there are many JSTL tags used in the page, like a certain number of <c:forEach> loops combined with <c:if> conditions and so on.

Upvotes: 1

Views: 3150

Answers (2)

BalusC
BalusC

Reputation: 1109002

There are only performance issues if the code is written inefficiently or generates relatively a lot of output (including whitespace!). There are several ways to improve the one or other:

  1. Cache repeated (complex) expressions or content in <c:set> for later reuse.
  2. If you have a lot of "show/hide" content, consider replacing them by Ajax instead of rendering them all to the page.
  3. Trim whitespace from the response using a filter. This can save ~40% of the bandwidth.
  4. Turn on GZIP compression at the server level. This can save ~70 of the bandwidth or even ~80% when used in combination with the whitespace trimmer.
  5. When you're displaying a table with >100 rows, consider filtering and pagination.

See also:

Upvotes: 3

Ramesh PVK
Ramesh PVK

Reputation: 15446

Page generation happens at server side and rendering happens at client side. JSTL tags gets converted to java code after jsp compilation, performance gets affected by how much response you are writing.

Could be you are writing too much content using loops, that is why it is taking time to flush the content.

Upvotes: 1

Related Questions