aspose file tools*
The moose likes JSP and the fly likes jsp versus servlets Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "jsp versus servlets" Watch "jsp versus servlets" New topic
Author

jsp versus servlets

Nidhi Jain
Ranch Hand

Joined: Mar 26, 2006
Posts: 31
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
Girish Solanke
Greenhorn

Joined: Mar 03, 2006
Posts: 13
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
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Think of JSP as an extension of servlets; specifically designed for formatting a textual response (HTML, etc...).


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper

Joined: Aug 26, 2006
Posts: 4968

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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: jsp versus servlets
 
Similar Threads
Diffrence between JSP and Servlets
Nested and Inner Class
diff between Requests objects
Diffrence between JSP and Servlets
Please anwer to my question?