• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Junilu Lacar
Sheriffs:
  • Rob Spoor
  • Liutauras Vilda
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Piet Souris
  • Tim Holloway
  • Jj Roberts
  • Stephan van Hulst
Bartenders:
  • Himai Minh
  • Carey Brown
  • Frits Walraven

jsp versus servlets

 
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Can anybody tell me the detailed diffrence between jsp and servlets.I only know that after complied jsp will trun into servlets.but that' not a diffrence.

Thanks
 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

As far as my knowledge is concern,

Servlet & JSP are act as servlet itself,

But basic difference between them is
Use JSP when you have more Presentation logic than Bussiness logic
&
Use Servlet when you have more Business logic than Presentation logic



Regards
Girish
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Think of JSP as an extension of servlets; specifically designed for formatting a textual response (HTML, etc...).
 
author and cow tipper
Posts: 5001
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Functionally, you could say Servlets and JSPs are the same. They both are compiled and run as Servlets on the JVM. Pretty much anything you can do in a Servlet, you can do in a JSP.

Having said that, JSPs are obviously designed to serve markup to the client, but it HTML, HTML, XML or WML. They are easy to manipulate in a builder tool. Servlets typically defer to a JSP for markup generation.

Servlets are all about the Java. You can write all sorts of control code in a Servlet. A Servlet typically handles an incoming request, and figures out how to handle that incoming request, which usually involves validation, calling on JavaBeans and EJBs, and as I mentioned, deferring to a JSP for markup generation.

JSPs are mostly HTML with a little bit of Java in them. Servlets are largely Java, with the occassional and rare bit of HTML. Someone more clever than me once remarked that "JSPs are just Servlets turned inside out."

I've got a bit more on how Servlets and JSPs fit into MVC on my website. Here's the link:

http://www.technicalfacilitation.com/get.php?link=whatismvc
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic