File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Factors for Servlets and JSP

 
Rama Krishna Yalamanchili
Greenhorn
Posts: 25
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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)?
Thanks
YRK
 
jim chou
Greenhorn
Posts: 4
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Posts: 13048
6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
Bill
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic