You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Matt Barnicle <br...@barnicle.org> on 2002/03/13 21:30:15 UTC

Problem with mapping - prepending a slash

Hey all..  I've been working on this on and off for days.  I searched the
mail archives, even looked at the source code, no luck.  When I submit a
form once, it works.  If that same forms gets redisplayed to the user
(say, on invalid input), the struts html:form tag prepends an extra slash
to the action.  I.e., if the original action was "/peopleSearch.do", then
when the form gets submitted, make a round trip, and gets redisplayed to
the user, the action becomes "//peopleSearch.do".

And now, here is more information than you wanted to know...

Here is the HTML:

<html:form action="/peopleSearch.do" method="GET">

I've got the corresponding form-bean and action:

    <form-bean
      name="peopleSearchForm"
      type="org.kp.eds.wpd.forms.PeopleSearchForm" />

    <action
        path="/peopleSearch"
        type="org.kp.eds.wpd.actions.PeopleSearchAction"
        name="peopleSearchForm"
       input="/jsp/people_search.jsp">
      <forward name="success" path="/jsp/people_search_results.jsp" />
    </action>

And the related java Action class (simplified for brevity):

if (foo) {
    return(mapping.findForward("success"));
}
else {
    return(new ActionForward(mapping.getInput()));
}

Submitting the form works fine.  I can execute code in the Action class,
return results to the page, yadda yadda.  In the case that the user filled
out bad data, the form is re-displayed to them, with an error message
(hey man, please fill out the form again).

My platform:

Struts 1.0.2
Jetty 4.0B2
SunOS5.8/Solaris 8

Thanks for any pointers!  If I don't get no answers, I'm gonna have to
step through the source code...  :-(

- M@


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Problem with mapping - prepending a slash

Posted by keithBacon <ke...@yahoo.com>.
Hi Matt,
>> I wonder if anyone on the list is getting my messages
>> Hello?  Is there anybody in there?

The silence is respect for the quality of your problem.
I'd suspect your servlet container is returning some path info differently than
normal (but I'm no expert).
Maybe try it on Tomcat?


--- Matt Barnicle <br...@barnicle.org> wrote:
> Well, I didn't get any feedback yet, so I dug into the code.  I had to
> change getActionMappingURL() in FormTag.java from this:
> 
>         // Return the completed value
>         return (value.toString());
> 
> to this:
> 
>         String valueStr = value.toString();
>         if (valueStr.startsWith("//"))
>             valueStr = valueStr.substring(1);
> 
>         // Return the completed value
>         return (valueStr);
> 
> ...for my problem to go away.  Am I doing something wrong in the below
> email?  I wonder if anyone on the list is getting my messages (I just
> joined yesterday).  Hello?  Is there anybody in there?  Just nod if you
> can hear me....
> 
> - M@
> 
> On Wed, 13 Mar 2002, Matt Barnicle wrote:
> 
> > Hey all..  I've been working on this on and off for days.  I searched the
> > mail archives, even looked at the source code, no luck.  When I submit a
> > form once, it works.  If that same forms gets redisplayed to the user
> > (say, on invalid input), the struts html:form tag prepends an extra slash
> > to the action.  I.e., if the original action was "/peopleSearch.do", then
> > when the form gets submitted, make a round trip, and gets redisplayed to
> > the user, the action becomes "//peopleSearch.do".
> > 
> > And now, here is more information than you wanted to know...
> > 
> > Here is the HTML:
> > 
> > <html:form action="/peopleSearch.do" method="GET">
> > 
> > I've got the corresponding form-bean and action:
> > 
> >     <form-bean
> >       name="peopleSearchForm"
> >       type="org.kp.eds.wpd.forms.PeopleSearchForm" />
> > 
> >     <action
> >         path="/peopleSearch"
> >         type="org.kp.eds.wpd.actions.PeopleSearchAction"
> >         name="peopleSearchForm"
> >        input="/jsp/people_search.jsp">
> >       <forward name="success" path="/jsp/people_search_results.jsp" />
> >     </action>
> > 
> > And the related java Action class (simplified for brevity):
> > 
> > if (foo) {
> >     return(mapping.findForward("success"));
> > }
> > else {
> >     return(new ActionForward(mapping.getInput()));
> > }
> > 
> > Submitting the form works fine.  I can execute code in the Action class,
> > return results to the page, yadda yadda.  In the case that the user filled
> > out bad data, the form is re-displayed to them, with an error message
> > (hey man, please fill out the form again).
> > 
> > My platform:
> > 
> > Struts 1.0.2
> > Jetty 4.0B2
> > SunOS5.8/Solaris 8
> > 
> > Thanks for any pointers!  If I don't get no answers, I'm gonna have to
> > step through the source code...  :-(
> > 
> > - M@
> > 
> > 
> 
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
> 


=====
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Search the archive:-
http://www.mail-archive.com/struts-user%40jakarta.apache.org/
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Keith Bacon - Looking for struts work - South-East UK.
phone UK 07960 011275

__________________________________________________
Do You Yahoo!?
Yahoo! Sports - live college hoops coverage
http://sports.yahoo.com/

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Problem with mapping - prepending a slash

Posted by Matt Barnicle <br...@barnicle.org>.
Well, I didn't get any feedback yet, so I dug into the code.  I had to
change getActionMappingURL() in FormTag.java from this:

        // Return the completed value
        return (value.toString());

to this:

        String valueStr = value.toString();
        if (valueStr.startsWith("//"))
            valueStr = valueStr.substring(1);

        // Return the completed value
        return (valueStr);

...for my problem to go away.  Am I doing something wrong in the below
email?  I wonder if anyone on the list is getting my messages (I just
joined yesterday).  Hello?  Is there anybody in there?  Just nod if you
can hear me....

- M@

On Wed, 13 Mar 2002, Matt Barnicle wrote:

> Hey all..  I've been working on this on and off for days.  I searched the
> mail archives, even looked at the source code, no luck.  When I submit a
> form once, it works.  If that same forms gets redisplayed to the user
> (say, on invalid input), the struts html:form tag prepends an extra slash
> to the action.  I.e., if the original action was "/peopleSearch.do", then
> when the form gets submitted, make a round trip, and gets redisplayed to
> the user, the action becomes "//peopleSearch.do".
> 
> And now, here is more information than you wanted to know...
> 
> Here is the HTML:
> 
> <html:form action="/peopleSearch.do" method="GET">
> 
> I've got the corresponding form-bean and action:
> 
>     <form-bean
>       name="peopleSearchForm"
>       type="org.kp.eds.wpd.forms.PeopleSearchForm" />
> 
>     <action
>         path="/peopleSearch"
>         type="org.kp.eds.wpd.actions.PeopleSearchAction"
>         name="peopleSearchForm"
>        input="/jsp/people_search.jsp">
>       <forward name="success" path="/jsp/people_search_results.jsp" />
>     </action>
> 
> And the related java Action class (simplified for brevity):
> 
> if (foo) {
>     return(mapping.findForward("success"));
> }
> else {
>     return(new ActionForward(mapping.getInput()));
> }
> 
> Submitting the form works fine.  I can execute code in the Action class,
> return results to the page, yadda yadda.  In the case that the user filled
> out bad data, the form is re-displayed to them, with an error message
> (hey man, please fill out the form again).
> 
> My platform:
> 
> Struts 1.0.2
> Jetty 4.0B2
> SunOS5.8/Solaris 8
> 
> Thanks for any pointers!  If I don't get no answers, I'm gonna have to
> step through the source code...  :-(
> 
> - M@
> 
> 


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>