Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JSP vs Servlets

 
dhanu sudha
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Whats the difference between JSP and servlets?
on Performance basis which is the best and how?
 
Jessica Sant
Sheriff
Posts: 4313
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Naveen Sydney
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic