0

I want to know whether any problem or load on the server when a big static html file is included in JSP.

Whether the server takes load in including the file on startup. I know that server converts and compiles the jsp only once on startup. And the page is rendered directly as servlet whenever user hits it.

I had a debate with my manager on this. Can you please provide me some information on this. I need Pros and Cons by doing this (server load / client load / anything related).

Sandeep
  • 2,041
  • 21
  • 34
  • how the server knows content is static or how to decide whether recomplile the code (in case of dynamic contents are found)? I don't know how java works, I leave this comment to get an idea – newday Jan 22 '13 at 05:21
  • 1
    for hot deploy whenever a jsp is changed server detects the change and recompiles. for normal deploy whenever the server is restarted it compiles the jsps. dynamic content is taken care by the servlet – Sandeep Jan 22 '13 at 05:29
  • http://stackoverflow.com/questions/4965914/java-jsp-vs-servlet – newday Jan 22 '13 at 06:11
  • i know what a `jsp-servlet` is. but i want to know if at all i include a big html file inside a jsp would it effect the performance at the server level. – Sandeep Jan 22 '13 at 06:17
  • it says servlet is fater than jsp. – newday Jan 22 '13 at 06:20

1 Answers1

1

java translates jsp content into a class, which basically acts like this:

JSP file with content such as:

<div>this is regular html</div>
<%
System.out.println("this is code");
%>

is translated into:

out.println("<div>this is regular html</div>");
System.out.println("this is code");

where out is the response output stream.

so all your static content will be translated into such response out function calls, which technically is probably a bit slower than just sending the whole file back in one big chunk.

There's also the possibility of caching on the client side when static content is used, something you can't do when you embed dynamic data in there. You can also serve it from a CDN network instead of serving it directly from your app servers.

And last, you can serve all your static data from a web server and your dynamic data from your app server if this is the way your system is set up, which might make some sense.

TheZuck
  • 3,513
  • 2
  • 29
  • 36