• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

JSP vs Servlets

 
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?
 
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.
 
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
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!