Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

difference  RSS feed

 
rakesh choubey
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
well i have some doubts what is the difference between JSP and Servelets. i would be grateful if anyone help me.

regards
rakesh
 
Marco Ehrentreich
best scout
Bartender
Posts: 1294
IntelliJ IDE Java Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi rakesh,

in short servlets are plain Java code whereas JSPs may contain Java code (scriptlets, expression etc.) and additionally markup like HTML.

Finally if you deploy a JSP to a servlet container like Tomcat even the JSPs get compiled to ordinary servlets with generated code who prints out the markup which was in the JSP.

Marco
[ May 30, 2008: Message edited by: Marco Ehrentreich ]
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JSP is a templating technology for creating dynamic HTML pages.
It is built on top of Servlets.

When first hit, the servlet container (server) compiles the JSP code into servlet code and then deploys it as a servlet. This gives you all the performance benefits of pre-compiled and pre-loaded Java classes, plus the ease of use found in other web scripting languages, like PHP, Perl, or ASP.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!