This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
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

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
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
Similar Threads
Doubt on Protocol & Port number
Reply me Soon
how i can exclude a url pattern from a filter ?
Favourite "Head First" girl?
Servlet and JSP Book