Win a copy of Machine Learning for Business: Using Amazon SageMaker and JupyterE this week in the Jython/Python forum
or Object Design Style Guide in the Object-Oriented programming forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
  • Knute Snortum
Sheriffs:
  • Liutauras Vilda
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Joe Ess
  • salvin francis
  • fred rosenberger

What Servlet/JSP Architecture

 
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?
 
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.
 
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
 
What's a year in metric? Do you know this metric stuff tiny ad?
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!