• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JSP and Servlets

 
Deep Nain Kundra
Greenhorn
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What are the difference between JSP and Servlets?
 
james edwin
Ranch Hand
Posts: 393
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's like almost everything which you can do in servlet ,you can do in JSP too.But one difference i know between JSP and Servlet is :-

Servlet can be written for HTTP(HTTPSERVLET) and other protocols(GENERIC SERVLET) where as we can write JSP only for HTTP protocol.

If anyone else can add any point in this !!!

Regards,

James
 
satish sathineni
Ranch Hand
Posts: 46
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Servlets are used to develop dynamic webcontent ie WebApplications

Servlets are normal java classes Who generally have to extend
javax.servlet.http.HttpServlet class.

These are precompiled classes. (This is nothing but a Servlet Template)
Instead in a JSP java code is embedded in HTML for easier Page generation
as HTML code generation in Servlets could be very tedious if the HTML
data is large.
At Runtime the JSP/Servlet container converts the JSP into a Servlet and
executes it.


Regards
Satish
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not sure why this got posted in the 'Distributed Java' forum...

Moving to the JSP forum...
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic