aspose file tools*
The moose likes JSP and the fly likes Jsp and Servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Jsp and Servlet" Watch "Jsp and Servlet" New topic
Author

Jsp and Servlet

kiran babu ssr babu
Greenhorn

Joined: May 04, 2005
Posts: 3
My question is, what a that which a servlet can do which cannot be done by jsp.
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

To answer your question directly, there is nothing that a servlet can do that a JSP can't. JSPs get compiled into servlets by the container.

A servlet is better laid out for handling control flow and interacting with back end objects. If you need to stream binary data you're better off using a servlet.

JSPs are best suited to for formatting your data and mixing it with HTML after all the heavy work has been done in a servlet.

If I had to, I could pound in nails with the back of a wrench but I'd prefer to use a hammer.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12682
    
    5
To answer your question directly, there is nothing that a servlet can do that a JSP can't. JSPs get compiled into servlets by the container.

In order to make a JSP stream binary content such as an image you have to write something that doesn't really look like JSP - or do you have some magic method?
Bill


Java Resources at www.wbrogden.com
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Originally posted by William Brogden:

In order to make a JSP stream binary content such as an image you have to write something that doesn't really look like JSP - or do you have some magic method?
Bill


No, I do not have a magic method and, Yes I agree, you would have to write an extremely ugly JSP.
This is why I said:
If you need to stream binary data you're better off using a servlet.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Jsp and Servlet
 
Similar Threads
Servlets and JSP
Strange Behaviour of jsp:param action
Servlet and jsp specification
JSP and servlet book
Difference between servlet and jsp?