Craig,

>> I have a servlet that reads a list of JSP pages from
>> a property I defined (in the 'init' method).  When a request
>> is sent to my servlet, it uses the RequestDispatcher to
>> 'forward' each request it receives to the next page in
>> the list.  It keeps track of the current page in it's
>> session data.
>>
>> Each JSP presents a form to collect information from the user.
>> When the form is submitted, it will create an XML document,
>> which it will POST back to my servlet.  My servlet will save
>> the XML in the session data, then 'forward' the request to
>> the next JSP in the list.  Once all have been run, my servlet
>> will parse and validate the complete XML document that has been
>> constructed by each JSP page, then make the appropriate updates
>> to a database.  It will then reset the session data so that the
>> next request will start the process all over again.
>>
>> Since servlet/JSP/XML programming is still new to me, I am wondering
>> if the above approach makes sense, or if there is a better way
>> to accomplish the above.
>>
>
>In general, this seems like a pretty reasonable approach.  If the XML you
>create as a result of each form is independent of that created on other
forms,
>an alternative might be to just collect the input fields in your session, and
>then produce the final XML document after the last one has been entered --
but
>this is really an issue of which is easier to write and maintain.

Since others will be developing the JSPs, and hence defining their XML
documents (along with their DTDs), it seems cleaner to me to just
let each JSP create it's XML, and then when all have finished, my
servlet will parse and process the composite document.  Of course,
I suppose I could impose a form field naming convention on each JSP
writer, but I'm trying to keep the rules for writing these JSP scripts
as simple as possible.  Of course, I haven't thought this through
completely, so I may be missing something.

>> One thing I notice when I 'forward' the request to a JSP page
>> is that the URL path seems to be set to that of the servlet.
>> Thus, even though I forward to a URL in another directory,
>> relative references to graphics, etc in the JSP page don't work,
>> since they are looked for in /servlet/xxx.gif, which of course,
>> doesn't exist.  Do I have to include absolute URLs to get this to
>> work?  Or is there a way to change the pathname in the request?
>>
>
>When you do a RequestDispatcher.forward(), the "redirection" happens on the
>server side, without the client browser knowing about it.

Understood.

>..If you really want
>the browser URL to change, you can do a sendRedirect() instead, but then
>you're paying the performance penalty of an extra round trip across the
>network.  Users of dynamic web applications (as opposed to your typical web
>site) need to understand that the URLs that are displayed are basically
>irrelevant, because you can't just bookmark into the middle and proceed from
>there.  In most cases, I run these kinds of apps in frames (where the visible
>URL does not change anyway), or in a new browser window that doesn't even
show
>the URL, to emphasize the fact that navigation controls on the page are the
>only way to move around.

I'm not too concerned with the URL that is displayed.  I just want
the JSP writer to be able to place their JSP anywhere on the same
web site, and be able to use relative URIs to reference images and
stuff as they would expect.

>For your image references, the servlet engine will normally let you define a
>"default" servlet for the application that is executed when no servlet path
>can be found in a URL.  If this servlet is a file-serving servlet, then it is
>easy to use paths for images (such as "/images/xxx.gif" in a way that is
local
>to your application.  You just need to worry about configuring the associated
>servlet context to tell it what the document root directory is.  This is, in
>fact, how the 2.1 JSDK servlet engine serves static resources, and most other
>2.1 engines will have something similar.

I think this is what I need to do, but I don't quite understand how.
Can you be a bit more specific?  Thanks very much for your help.
I really appreciate it.

BTW, I'm using JWS 2.0 for now, so if you know details on how
to configure JWS to do the above in that environment, please let me know.
Thanks again.
    -- Bill

--
Bill O'Keefe                                     [EMAIL PROTECTED]
Open Market, Inc.                            http://www.openmarket.com/
One Wayside Road                                 TEL: 781.359.7296
Burlington, MA 01803                             FAX: 781.359.8200

___________________________________________________________________________
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

Reply via email to