Yeah, I think my best option here is to just convert my list of ints to a comma separated list. It seems though, that since the request object can handle lists, that there should be a way to add list parameters in struts.

Right now the function to add a parameter in ServletRedirectResult looks like:

    public ServletRedirectResult addParameter(String key, Object value) {
        requestParameters.put(key, String.valueOf(value));
        return this;
    }

But it seems that maybe there should be one to handle something like a list of strings. Right now adding a list as a parameter just results in the java toString of it, which isn't much help.

Anyways, thanks for the help.

-Tim

On 1/29/2010 1:44 PM, Greg Lindholm wrote:
If you are using a result type of "redirectAction" you don't
explicitly code the url just give it the action name and let the
result construct the correct url.

To pass parameters with a redirectAction you do it like this:

       <result name="success" type="redirectAction">
         <  param name="actionName">CompleteConfirmation</ param>
         <  param name="orderNumbers">${orderNumbers}</ param>
       </result>

(hopefully the above param tags come thru correctly, some mailing list
readers like nabble muck-up param tags.)

You will need to ensure the ${orderNumbers} can be converted to a
meaningful string so that it can be encoded as a url parameter. And
the target action will need to be able to convert the string back into
a collection.

You will also need to be aware that there are length limits to url's
so if orderNumbers is too big you can have problems.

It may be a a better idea to just save the orderNumbers in the session
(or some other cache) instead of passing it as a parameter.


On Fri, Jan 29, 2010 at 1:25 PM, Timothy Orme
<to...@genome.med.harvard.edu>  wrote:
Right, this is similar to what I want, but it would have to be dynamically
generated, as I don't know the size of the list. For instance, in this case,
the user would have selected 4 orders, but in the next case could select 10.
The problem isnt passing parameters, it's passing a parameter thats a list.

On 1/29/2010 1:22 PM, Eric Rich wrote:
Sorry the line result should be like this:


<result name="success" type="redirectAction"
s>test/CompleteConfirmation.action?orderNumbers=${ordernumber1}&amp;orderNumbers=${ordernumber2}&amp;orderNumbers=${ordernumber3}&amp;orderNumbers=${ordernumber4}</result>

Eric Rich
Data System Administrator

Murray State University
Address:  226 Alexander Hall
         Murray, KY 42071-3340
TEL :     270-809-3358
FAX:      270-809-5359

On 01/29/2010 12:14 PM, Eric Rich wrote:
Timothy,

    If I understand you correctly you want to redirect and pass values.  I
have done this by encoding my url with proper html syntax.

<action name="CompleteOrders" class="test.CompleteOrdersAction">
<result name="success" type="redirectAction"

s>test/CompleteConfirmation.action?orderNumber&amp;${orderNumbers}</result>
</action>
I hope this helps.

Eric Rich
Data System Administrator

Murray State University
Address:  226 Alexander Hall
           Murray, KY 42071-3340
TEL :     270-809-3358
FAX:      270-809-5359

On 01/29/2010 11:12 AM, Timothy Orme wrote:
Hello All,

       I have a typical scenario:

       1. User is presented a list of orders, and can select some of them
to complete. A list of order numbers is sent to the next action.
(ViewOrders.action)
       2. Struts action completes the order by iterating through the list
of passed order numbers. (CompleteOrders.action)
       3. The user is redirected to a confirmation action, listing the
orders that were completed. (CompleteConfirmation.action)

       The question I have is getting from step 2 to 3.

       This is a fairly standard redirect-after-post setup, but I want to
be able to redirect to a confirmation action and pass a parameter list.
Essentially what I want is:

<action name="CompleteOrders" class="test.CompleteOrdersAction">
<result name="success" type="redirectAction">
<param name="actionName">CompleteConfirmation</param>
<param name="namespace">/test</param>
<param name="orderNumbers">${orderNumbers}</param>
</result>
</action>

       Resulting in a redirect to:


test.com/test/CompleteConfirmation.action?orderNumbers=1&orderNumbers=2&orderNumbers=3&orderNumbers=4

       However, this doesn't seem to work. Has anyone found a way to do
this?

       I realize there are ways to do this by using the session, but Id
prefer to pass this through the URL if possible.

Thanks,
Tim

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

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

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

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


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


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

Reply via email to