This week's book giveaway is in the Agile and other Processes forum. We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line! See this thread for details.
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
posted
0
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.
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.