Troy:

That's because the last path your browser *saw* was /do/xxxx. It doesn't see the 
forward (that happens in the server) so it's trying to load all the page relative 
URI's from the last URL it knows about. You should be able to fix this with a 
<html:base> your page (in the <head> section).

Regards,
 
Rich


-----Original Message-----
From: Poppe, Troy [mailto:[EMAIL PROTECTED] 
Sent: Friday, June 13, 2003 3:11 PM
To: '[EMAIL PROTECTED]'
Subject: ActionForm.validate() always forward()s to input page?


I couldn't find anything in the archives regarding this issue, so here it goes.

I have a jsp page that is located at <context path>/signature.jsp, and it loads
resources (images and CSS sheets) from <context path>/img and <context
path>/common respectively.

I have an ActionForm, SignatureForm, and an Action, SignatureAction, that uses
the ActionForm.

My <action> tag is as follows:

        <action
            attribute="signatureForm"
            name="signatureForm"
            path="/sign"
            type="gov.doe.eia.pms.action.SignatureAction"
            input="/signature.jsp"
            validate="true">
            <forward name="success" path="/selectEmployee.jsp" redirect="true" />
        </action>

I am using the /do/* mapping for the ActionServlet

When the SignatureForm is validated, it correctly determines that something is
invalid, or otherwise incorrect.  It appears that the request is then forwarded
to the input page.  BUT, as a result, the URIs for all the resources (e.g.
"img/save.gif") are now <context path>/do/img/save.gif.  Obviously this breaks.

I've looked in the ServicesServlet.java, where it appears that the
ActionForm.validate(...) method is called.  Here's the code snippet of interest:

<snippet>
283:        RequestDispatcher rd = getServletContext().getRequestDispatcher(uri);
284:        if (rd == null) {
285:            response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
286:                               internal.getMessage("requestDispatcher",
287:                                                   uri));
288:            return (false);
289:        }
290:        rd.forward(request, response);
</snippet>

The question is, am *I* doing something wrong as to how I am handling the errors,
or is there a better way to do what I am trying to do, or is this just plain
broken?

Any assistance is greatly appreciated.

Troy Poppe


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to