Originally posted by Preethi Suryam:
The basic advantage of JSP over servlets is that it seperates the presentation part from the logical part.
Um, no. It does no such thing. JSPs separate presentation and logic no more or less than servlets do.
What JSPs do for you is give the presentation a central place in your source. The logic is embedded in the presentation. In a servlet, the logic is central and the presentation embedded in the logic. Thereby, it becomes obvious when
you should choose JSPs over servlets: whenever presentation is more important than logic.
Separation of presentation and logic is quite another matter. It's something YOU have to do, JSPs don't greatly help you there. To the contrary, I would say that the temptation to stick bits of
Java logic absolutely everywhere is too great.
It is up to you to implement a clean MVC architecture. The View, then, is purely concerned with presentation and should usually be a JSP. Taglibs can help you get the last bits of logic out of there. The Controller, responding to HTTP requests, is purely concerned with logic and should be driven from a servlet. The Model, finally, is a pure-code affair that is best implemented using Java classes (usually JavaBeans and/or EJBs).
when a request comes to HTTP server the servlet(jsp file converted into servlet) is not complied again and again for the same request, so this is time consuming than servlet.
hope u got the answer for ur question.
I'm not sure what you mean here. JSPs and Servlets don't really differ in performance.
- Peter