From: "Mitchell, Steven C" <[EMAIL PROTECTED]>
> I'm curious to hear what other people are doing regarding the passing of
> data between actions.  Take for example an advanced search page with
> validation, drop down lists, the works.  Upon successful validation the
> user should flow to a search results page.  Assume the results page is
> part of something bigger that may require additional server-side
> processing.

I'll be interested in other responses... I had to make this work in my first
Struts webapp, three years ago (!) now.  I doubt I got it "right," but it
does work.

I have a 'person lookup' that has to be shared across many forms.  Anywhere
there is a text box with an 'add person' button, it has to go off to
resolution, and most importantly, it has to come back and add the selected
person to the right original form.

Struts doesn't have a concept of 'go back where you came from' so I set
request attributes before forwarding to the ResolveName action.  And I do
chain them:
   <action    path="/editReminder" ... >
       <forward name="resolution"     path="/resolveName.do" />
       <forward name="saved"           path="reminder.confirm" />
    </action>

This is the one case where I couldn't get around going from
Action-to-Action, which is (or was, I'm not so sure anymore...) frowned
upon.

In the LookupDispatchAction, which uses userAction to switch methods, I set
request attributes for nameOrId, returnTo, and userAction.

Then ResolveNameAction picks up 'nameOrId' and does its thing, and in the
resulting JSP, I just used a plain old HTML form:
   <form action="<c:out value="${returnTo}"/>" method="POST">
   <input type="hidden" name="userAction" value="<c:out
value="${userAction}"/>" />
   ...then iterate through the choices...

When the user submits that form, you're back to the original Action.

HTH,
-- 
Wendy Smoak


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

Reply via email to