my dog learned polymorphism*
The moose likes JSP and the fly likes JSP vs Servlets Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "JSP vs Servlets" Watch "JSP vs Servlets" New topic
Author

JSP vs Servlets

dhanu sudha
Greenhorn

Joined: Apr 16, 2002
Posts: 11
Whats the difference between JSP and servlets?
on Performance basis which is the best and how?
Jessica Sant
Sheriff

Joined: Oct 17, 2001
Posts: 4313

On the first request -- the JSP will require to be translated and compiled into a servlet (unless it was precompiled) -- so on the first request the JSP will definately be slower. But after that they should perform similarly (both are servlets).
Realize though, that there are situations where a JSP is better equipt than a servlet (like when heavy amounts of output is sent to the screen) and vice-versa.


- Jess
Blog:KnitClimbJava | Twitter: jsant | Ravelry: wingedsheep
Naveen Sydney
Ranch Hand

Joined: Jan 21, 2002
Posts: 30
hi
i agree with jessica. the important question u should be asking is what the servlet/jsp is really doing. If its just outputting html then u should design it in a jsp. if it played the role of a lets say a controllet u would be better off writing a servlet.
in a production environment u would do post-deployment testing --implying that u would have hit every jsp page and compiled them in the process, hence the performence would be the same. but as jess put it jsp are equiped to do certain stuff better than servlets and vice-versa.
regards
syd
 
wood burning stoves
 
subject: JSP vs Servlets