struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Craig McClanahan <craig...@gmail.com>
Subject Re: Submitting form does nothing
Date Tue, 27 Jul 2004 17:49:04 GMT
On Tue, 27 Jul 2004 09:12:21 -0700, Claire Suttle <claire@geoviz.com> wrote:
> Hi Craig,
> 
> >
> > The only thng I can think of that would cause the symptoms you
> > describe is if the URLs with which the forms are being submitted are
> > either incorrect (not mapping to the Struts servlet at all), or are
> > somehow not mapping to the correct action.  Have you double checked
> > the HTML source (use View Source in your browser) to make sure that
> > the "action" attribute of the <form> element is correctly formed,
> > based on what you have your servlet mapping set to?
> >
> 
> That's exactly what happens - the URL displayed in the action of the pages
> that don't work is incorrect. I have a couple of pages where the form
> command expands as
> 
> <html:form action="/AddNewUser.do">
> 
> and then in the rest it expands as
> 
> <html:form action="//NewProjectID.do">
> 
> I've now managed to track this down to the
> org.apache.struts.util.RequestUtils class, and the getActionMappingURL
> method. The second line of this method reads:
> 
> StringBuffer value = new StringBuffer(request.getContextPath());
> 
> on the pages that work, this line returns an empty string buffer. On the
> pages that don't work, the string buffer is returned containing a single
> character - '/'
> 
> Then, what I would expect to be filled in is filled in several lines down -
> 
> value.append(actionMapping);
> value.append(servletMapping.substring(1));
> 
> these two lines always evaluate to /actionname.do
> 
> So I now know where the extra '/' is coming from...but I really have no idea
> why
> 

It must be coming from your servlet container (i.e. the code inside
getContextPath()), and it's broken or misconfigured ... "/" is not a
legal context path.  If this is the default application for your
servet container, the context path returned by the container should be
"" (a zero length string).

> Thanks,
> Claire

Craig

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message