views:

35

answers:

1

Hi i like to build web application and im trying to think about way to reduce cpu/memory what will be faster for tomcat to use servlets to get the requests and render back the HTML or using jsp ?

+2  A: 

JSP has the advantage of seperating the presentation layer and business logic, and hence convinient at development. First time when JSP engine encounter JSP request, it convert JSP in servlet, compile it and the bytecode format it saves in JSP Container along with the time stamp. Due to this process the first time response of JSP as compaired to servlets is slower, much slower. But from next request onword JSP engine checks the time stamp of the request and of JSP compiled file in JSP Container in JVM, and if the file is not changed then it redirects this request to that class file. And client get the response. In case of servlet the compiled servlet, ie class files are stored in Servlet Container in JVM. As both servlet and JSP is handled with same processes and sharing the resourses (JVM), there is no difference in performance of both. Altough i know and feel it this way but if really there is a difference i am curious to know them

sushil bharwani
i have another question i dont know if its related to this but how about using java as the framework for web application to the masses?
It depends upons what kind of web application you are developing. Java specifically is used mostly for robust enterprise level applications and for masses. But if you have simple websites which requires less user interaction you may use php also
sushil bharwani