• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

What Servlet/JSP Architecture

 
Bruno Collins
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have the scenario where I wish to view, edit, and delete data from a table in a database. I am taking the MVC approach. I use a HTML/JSP page initiate a servlet which connects to the database, runs a SQL query and places the result set (list) in a vector of beans. Control is then forwarded to a JSP page that paints the list of the matching rows together with links to "view", "edit", or "delete" the row and "add" a new row. Should these links be to four different controlling servlets eg: ViewItem, EditItem, DeleteItem, AddItem or to a single servlet that does all e.g ProcessItem?action=view etc. Some processing will be common e.g validation of a new or altered row. This is a pretty common requirement. How are people approaching this?
 
Graeme Brown
Ranch Hand
Posts: 193
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A lot depends on the complexity of your application.
Single servlet would probably be more maintainable.
Other things you may want to consider are the "command design pattern" either on it's own, or as implemented by apache struts.
There is a good discussion of struts here: http://www-106.ibm.com/developerworks/java/library/j-struts/ , you might want to start with the pros and cons listed at the bottom.

The official struts page is here: http://jakarta.apache.org/struts/
[ February 05, 2002: Message edited by: Graeme Brown ]
 
Bruno Collins
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the link. I'll check it out.
 
Adam Hardy
Ranch Hand
Posts: 567
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually I was looking at it today and if you follow the resources link on the struts home page, you'll see a whole bunch of links to articles & tutorials.
Adam
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic