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

What Servlet/JSP Architecture

Bruno Collins
Greenhorn

Joined: Nov 30, 2001
Posts: 19
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

Joined: Oct 13, 2000
Posts: 193
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

Joined: Nov 30, 2001
Posts: 19
Thanks for the link. I'll check it out.
Adam Hardy
Ranch Hand

Joined: Oct 09, 2001
Posts: 566
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


I have seen things you people would not believe, attack ships on fire off the shoulder of Orion, c-beams sparkling in the dark near the Tennhauser Gate. All these moments will be lost in time, like tears in the rain.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: What Servlet/JSP Architecture