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

JSP vs Servlets

dhanu sudha

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

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
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.
I agree. Here's the link:
subject: JSP vs Servlets
It's not a secret anymore!