You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by James Mitchell <jm...@telocity.com> on 2002/06/12 22:15:26 UTC

RE: If several JSPs share the same action mapping...?

Right, you will not know which jsp submitted the form unless you:

1. find out from the request (request uri)
2. tell the action by some hidden form var or on the url action (html)

either way you've got to create a hack to pass the correct ActionForward.


sorry for my quick (not-so-pretty) replies, I'm working on a hot project and
coding on one machine and monitoring the list on the laptop.  I'm
multi-tasking
both mentally, and physically ;)  (My alt-tab is a quarter turn to the left)

James Mitchell
Software Engineer\Struts Evangelist
Struts-Atlanta, the "Open Minded Developer Network"
http://struts-atlanta.open-tools.org

> -----Original Message-----
> From: Rick Reumann [mailto:maillist@reumann.net]
> Sent: Wednesday, June 12, 2002 3:59 PM
> To: James Mitchell
> Cc: Struts Users Mailing List; Struts-Atlanta@open-tools.org
> Subject: Re[2]: If several JSPs share the same action mapping...?
>
>
> Sorry James, I don't think I described the situation to well and I'm
> sure there probably is a better way to handle this...
>
> Easiest way is an extreme example..
>
> What if you had 4 different JSPs that captured the same information in
> a form YET everything else on the page was radically different. Upon
> submission, though, you want to forward all the pages to the same
> Action and even possibly forward all of them to the same results page.
>
> The problem(I think) is you also want to validate the form
> information. I'm wondering how you would get the validation to know to
> return back to the correct JSP page if there were validation errors?
>
> I thought you needed to provide the input="yourJsp.jsp" so that it
> knew were to go back to, but if all 4 jsps shared this action mapping
> what would you put in the input="?" section? (maybe I'm totally wrong
> and the validation doesn't need that but I thought it did).
>
> Thanks for the help,
> Rick
>
> On Wednesday, June 12, 2002, 3:43:18 PM, James wrote:
>
> JM> Not sure why you are submitting a form from diff jsp, but one work
> JM> around might be to forward to a known jsp....
>
> JM> I'm guessing that you are passing something to the action to
> tell it where
> JM> you came from......
>
> JM> <!-- Save mail subscription -->
> JM> <action  path="/saveSubscription"
> JM>
> type="org.apache.struts.webapp.example.SaveSubscriptionAction"
> JM>            name="subscriptionForm"
> JM>           scope="request"
> JM>           input="/WEB-INF/jsp/subscription.jsp">
> JM>   <forward name="success"
> path="/editRegistration.do?action=Edit"/>
>
> JM>   <forward name="fail-jsp1"       path="/jsp1.jsp"/>
> JM>   <forward name="fail-jsp2"       path="/jsp2.jsp"/>
> JM>   <forward name="fail-jsp3"       path="/jsp3.jsp"/>
>
> JM> <!-- or you might use a different exception -->
> JM>       <exception
> JM>                 key="failure.reason1"
> JM>                type="org.apache.struts.webapp.exception.Reason1"
> JM>                path="/jsp1.jsp"/>
>
> JM> </action>
>
> JM> I didn't actually run this.....so.....hope it gives you some ideas.
>
>
>
> JM> James Mitchell
> JM> Software Engineer\Struts Evangelist
> JM> Struts-Atlanta, the "Open Minded Developer Network"
> JM> http://struts-atlanta.open-tools.org
>
> >> -----Original Message-----
> >> From: Rick Reumann [mailto:maillist@reumann.net]
> >> Sent: Wednesday, June 12, 2002 3:31 PM
> >> To: Struts List
> >> Subject: If several JSs share the same action mapping...?
> >>
> >>
> >> How to do you deal with the input="?" parameter when setting up an
> >> action mapping that different JSPs will share? I thought this "input"
> >> declaration was so if you are using validation it knows which page to
> >> return to with the validation errors. How is this accomplished when
> >> you have different JSPs that could share this action mapping but also
> >> need to be validated and thus I think also require the input field to
> >> be supplied?
> >>
> >> TIA
> >>
> >> --
> >>
> >> Rick
> >> mailto:maillist@reumann.net
> >>
> >> "Maybe in order to understand mankind, we have to look at the word
> >> itself: 'Mankind'. Basically, it's made up of two separate words -
> >> 'mank' and 'ind'. What do these words mean ? It's a mystery, and
> >> that's why so is mankind."
> >>   -Jack Handey
> >>
> >>
> >> --
> >> To unsubscribe, e-mail:
> JM> <ma...@jakarta.apache.org>
> JM> For additional commands, e-mail:
> JM> <ma...@jakarta.apache.org>
>
>
>
>
> --
>
> Rick
> mailto:maillist@reumann.net
>
> "It's amazing to me that one of the world's most feared diseases would
> be carried by one of the world's smallest animals: the real tiny dog."
>   -Jack Handey
>
>


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