• 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
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

Servlet reading a JSP file

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How would a servlet read a jsp file and display. I want to be able to display its contents after operations in the servlets...
 
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

I feel that by using "jsp + bean" can accomplish almost everything already. Can anyone give me some good reasons for using Servlet?
 
sharp shooter, and author
Posts: 1913
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A good example of why you might want to use a Servlet is to process a HTML form submission. This relates back to the "Model-View-Controller" (MVC) architecture where a controller (in this case a Servlet) might perform some processing, modify the model (e.g. JavaBeans or EJBs) and then redirect the user to another view (in this case a JSP).
Splitting up the logic in this way allows you to decouple the processing from the view and therefore allows you to change either easily. This also achieves the "goal" of reducing the amount of Java code required inside JSPs.
Taking a more pragmatic approach, of course there's nothing stopping you processing forms with JSPs, especially for small applications.
Hope that helps.
Cheers
Simon
------------------
Simon Brown
Co-author of Professional JSP 2nd Edition
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic