>>> "Shirley W. Powers" <[EMAIL PROTECTED]> 24-Jan-00 4:30:21 PM >>>
>I was wondering if I can have more than one method that uses
>ServletRequest and ServletResponse in a servlet. I am trying to
>write two outputs, one to a mail message and the other to the
client.
Ok.
>Should I setup two methods that output to the two different
>sources or can I only have one response output? Should I try
>to write to both the mail and the browser
The best way to think of servlets is as a web version of the main()
method.
That is a doPost() or doGet() method is just the entry point from the
web and the HttpServletRequest and HttpServletResponse objects are
just your interface to that connection.
That being so the best way to deal with any kind of complex program
is to build some object that encapsulate the functionality you want
and then manipulate those objects from your doGet() or doPost()
method.
>Should I do two different servlets even though I will be using the
same data?
No. One servlet is ok.
You'll probably need to use doPost() o handle the form input. Your
method will then:
- process the request data
- read in the file (from the disc? not the web? if from web a bit
more tricky)
- create the mail
- send the mail
- send the response back to the browser
Hope this makes things clearer.
Nic Ferrier
___________________________________________________________________________
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