• Post Reply Bookmark Topic Watch Topic
  • New Topic

Diff b/w Servlet and JSP  RSS feed

 
Zafar Ali
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can any one explain the difference between both techonologies?
 
reddy palwai
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
http://www.vbsoftindia.com/vbsoft%20faq/jsp.html
JSP pages are compiled into servlets, so theoretically you could write servlets to support your web-based applications. However, JSP technology was designed to simplify the process of creating pages by separating web presentation from web content. In many applications, the response sent to the client is a combination of template data and dynamically-generated data. In this situation, it is much easier to work with JSP pages than to do everything with servlets.

 
Philip Shanks
Ranch Hand
Posts: 189
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I like to think of JavaServer Pages as servlets turned inside out. This is, of course, a gross oversimplification, but useful nonetheless.
In a servlet that produces HTML, the HTML must be embedded inside of the code, more specifically, inside of a lot of print/println calls.
Conversely, in a JSP page, you might find Java code interspersed with HTML, in a sense embededed within the HTML tags by use of <% %> delimiters.
In a well designed J2EE web application, you will find both JSP's and servlets. You should find little or no HTML in the servlets, and little or no Java in the JSP's. This is accomplished through liberal use of magic, er, um, Javabeans and other server-side objects.
PCS
[ November 14, 2002: Message edited by: Philip Shanks ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!