Ditto Doug
John Kirby
DISC
-----Original Message-----
From: Doug Turner [mailto:[EMAIL PROTECTED]]
Sent: Saturday, March 13, 1999 12:19 PM
To: [EMAIL PROTECTED]
Subject: Re: problem when updating a database
Why call a servlet to do the update? To my way of thinking, the servlet
should be concerned with managing session state, and all other functions
(manipulating business, or "model", objects, UI, databases), should be
handled by separate classes that know as little as possible about the
environment they are in. The servlet can manage the interaction of these
classes, or even that can be delegated to another, application-savvy class.
Just for starters, this makes testing a whole lot easier. For example,
servlet invoked
servlet creates session state, creates utility objects to handle UI (see
below), other initialization
servlet creates object to wrap info from client, tells wrapper object to
store itself
wrapper object manipulates database, reports results back to servlet
servlet examines return code
if update failed servlet invokes error processing method in UI
utility class
if update succeeded, servlet invokes OK response method in UI utility
class (may pass in wrapper
object if info from that is needed in response)
servlet updates state
servlet exits
This is very simple, and if the model object is more complex (as it almost
always is), you may actually have a separate class to handle the database
interactions. It also assumes that you don't need RMI or CORBA to
distribute functions across hosts, but I think the basic principle still
holds: try to achieve sharp boundaries between control functions, UI, and
the business objects, as in the MVC pattern and others.
HTH
----------
From: Cynthia Munoz <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Subject: problem when updating a database
Date: Saturday, March 13, 1999 12:52 PM
Hi
I have a problem:
I need to get some information from the client browser and then save it
to a table. In order to do that I have two servlets: One gets the data and
then sends the data by the mehod post to another servlet that saves it in a
database. Everything works fine. But I have a problem: I get a page with
the URL of the servlet that updates the database.!! I don't want that. How
can I do to just call a public method of the servlet that updates the
database.???? or do you have another suggestion
I woul appreciate any advice from you.
Thanks
Cynthia Mu�oz
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html