File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes Factors for Servlets and JSP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Factors for Servlets and JSP" Watch "Factors for Servlets and JSP" New topic

Factors for Servlets and JSP

Rama Krishna Yalamanchili

Joined: Feb 11, 2004
Posts: 25
Dear Ranchers,
A design level question....
When do i go for servlets? When do i go for JSP?
Since both are going to be finally servlets.....
While designing an Web App when do i say this will be a JSP and
this will be a servlet?
Is there a rule of thumb to say this functionality will be better implemented by Servlet or JSP?
Where would a Servlet fit better than JSP(Examples)?

You are not fed, if you dont ask. <img src="wink.gif" border="0"> <p>SCJP 1.4, i2CP, IBM s390 CP
jim chou

Joined: Feb 15, 2004
Posts: 4
you have to use the mvc design pattern to facilitate proper separation of servlet and jsp.
a servlet acts as the c(controller),which verifies from data,updates the model with the form data,and selects the next view as the response.
a jsp pages acts as the view ,which renders the html response,and and provides html form to permit user interaction.
William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 13024
And don't forget - JSP are designed to serve character streams only - if you need to serve image or other binary resource data, it will have to be with a servlet. See numerous discussions on the JSP forum about images.
JSP should be regarded as a convenience only - for applications that have a preponderence of pre-formatted HTML. If your HTML involves a lot of computed content, a servlet is probably best.
I agree. Here's the link:
subject: Factors for Servlets and JSP
It's not a secret anymore!