Author Login
Post Reply
user Digest 30 Jan 2010 04:37:56 -0000 Issue 8996
Topics (messages 204882 through 204894):
Re: Modifying action mapping per device type
204882 by: Gabriel Belingueres
204884 by: Marcus Bond
204892 by: Wes Wannemacher
Redirect List Parameter
204883 by: Timothy Orme
204885 by: Eric Rich
204886 by: Eric Rich
204887 by: Timothy Orme
204888 by: Greg Lindholm
204889 by: Timothy Orme
Re: Different results with spring
204890 by: Wes Wannemacher
204893 by: Miguel
Re: Boolean Type Conversion
204891 by: Wes Wannemacher
redirectAction not working
204894 by: Robby Atchison
Administrivia:
---------------------------------------------------------------------
To post to the list, e-mail: user@(protected)
To unsubscribe, e-mail: user-digest-unsubscribe@(protected)
For additional commands, e-mail: user-digest-help@(protected)
----------------------------------------------------------------------

Attachment:
user_204882.ezm (zipped)Another direction would be to try implementing your own Result type:
<action name="login" class="mypackage.LoginAction">
<result name="success"
type="myCustomDeviceDependentResult">index</result>
</action>
Then the result would check the device type the user is accessing the
application with, and you can try searching first for a:
index_brand_model.jsp, and if not found search for:
index_brand.jsp, then
index.jsp
When you find the right JSP page, just forward to it like the
ServletDispatcherResult do.
(I'm sure Convention plugin must have something like this already working.)
2010/1/29 Marcus Bond <marcus@(protected)>:
> Interesting, I hadn't thought of that. However a problem I see here with
> this approach is that it implies that there would be different versions or a
> different mapping for every view whereas in reality, if a page looks / works
> fine on say iphone, htc, windows mobile but doesn't on an old blackberry
> then I want to be able to create a tweaked page for one device, but all
> others would use the same page and mapping.
>
> Gabriel Belingueres wrote:
>>
>> How about using different packages/namespaces for the views?
>>
>> <package name="package_blackberry" namespace="/bb">
>> <action name="login" class="mypackage.LoginAction">
>> <result name="success">/bb/index.jsp</result>
>> </action>
>> </package>
>>
>> <package name="package_winmob" namespace="/wm">
>> <action name="login" class="mypackage.LoginAction">
>> <result name="success">/wm/index.jsp</result>
>> </action>
>> </package>
>>
>>
>> 2010/1/28 Marcus Bond <marcus@(protected)>:
>>
>>>
>>> Hi,
>>>
>>> I am wanting to implement a site such that some actions may have a
>>> different
>>> mapping depending upon the device used (e.g. regular browser / mobile
>>> device
>>> etc.) but what I don't want to do is have to litter my actions with this
>>> type of logic. It could be at the result mapping level (i.e. in
>>> struts.xml)
>>> such that say a result of success would map to a jsp of somePage.jsp for
>>> regular browsers and somePageMobile.jsp for a mobile device (there will
>>> be
>>> more complications to this as I'd like to be able to have fine grained
>>> control based on the user agent so there may be many versions of a jsp
>>> such
>>> as somePageWinMobile6_5_htc.jsp).
>>>
>>> There are couple of ways I can think of to do this, but they're ugly:
>>> - JSP level logic to render the page differently - dont want it, I'd
>>> rather
>>> individual jsp's for each supported device (or family) as this allows
>>> developers who are working on targeting a site to a specific device to
>>> concentrate on that device.
>>> - Tiles template level logic - again not ideal as I would like to be able
>>> to
>>> use specific templates for device types.
>>>
>>> Better but not perfect would be some sort of post action result modifying
>>> interceptor such that in the struts.xml I could define a number of
>>> different
>>> result mappings such as success, success_winmob, success_blackberry_storm
>>> and have the result string that has been returned from the action
>>> (success)
>>> modified by some sort of interceptor (e.g. appending the suffix prior to
>>> struts mapping it off to a view) - the filter itself could be configured
>>> as
>>> to whether or not to alter result strings based on the action and the
>>> user
>>> device. - Is it possible to modify the result string post action but
>>> prior
>>> to struts resolving the mapping? And if so would I have access to the the
>>> name of the action?
>>>
>>> Any suggestions here are greatly appreciated!
>>> Web technologies being used are Struts2, Tiles2 and JSP.
>>>
>>> Regards,
>>> Marcus
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-unsubscribe@(protected)
>>> For additional commands, e-mail: user-help@(protected)
>>>
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@(protected)
>> For additional commands, e-mail: user-help@(protected)
>>
>>
>>
>> __________ NOD32 4817 (20100129) Information __________
>>
>> This message was checked by NOD32 antivirus system.
>> http://www.eset.com
>>
>>
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>

Attachment:
user_204884.ezm (zipped)This could work ok, especially if there were a configuration file such
that the jsp to forward to could be specified on a per action/result
basis, which would prevent having to duplicate jsp files unnecesarily. I
would consider this, but unfortunately I am mostly using a result type
of "tiles" to hand over to Tiles2 for view generation. In theory I could
modify the tiles handler to support this..
I'll have to dig into Tiles code and maybe some struts code and see what
can be done.
Gabriel Belingueres wrote:
> Another direction would be to try implementing your own Result type:
>
> <action name="login" class="mypackage.LoginAction">
> <result name="success"
> type="myCustomDeviceDependentResult">index</result>
> </action>
>
> Then the result would check the device type the user is accessing the
> application with, and you can try searching first for a:
> index_brand_model.jsp, and if not found search for:
> index_brand.jsp, then
> index.jsp
>
> When you find the right JSP page, just forward to it like the
> ServletDispatcherResult do.
>
> (I'm sure Convention plugin must have something like this already working.)
>
> 2010/1/29 Marcus Bond <marcus@(protected)>:
>
>> Interesting, I hadn't thought of that. However a problem I see here with
>> this approach is that it implies that there would be different versions or a
>> different mapping for every view whereas in reality, if a page looks / works
>> fine on say iphone, htc, windows mobile but doesn't on an old blackberry
>> then I want to be able to create a tweaked page for one device, but all
>> others would use the same page and mapping.
>>
>> Gabriel Belingueres wrote:
>>
>>> How about using different packages/namespaces for the views?
>>>
>>> <package name="package_blackberry" namespace="/bb">
>>> <action name="login" class="mypackage.LoginAction">
>>> <result name="success">/bb/index.jsp</result>
>>> </action>
>>> </package>
>>>
>>> <package name="package_winmob" namespace="/wm">
>>> <action name="login" class="mypackage.LoginAction">
>>> <result name="success">/wm/index.jsp</result>
>>> </action>
>>> </package>
>>>
>>>
>>> 2010/1/28 Marcus Bond <marcus@(protected)>:
>>>
>>>
>>>> Hi,
>>>>
>>>> I am wanting to implement a site such that some actions may have a
>>>> different
>>>> mapping depending upon the device used (e.g. regular browser / mobile
>>>> device
>>>> etc.) but what I don't want to do is have to litter my actions with this
>>>> type of logic. It could be at the result mapping level (i.e. in
>>>> struts.xml)
>>>> such that say a result of success would map to a jsp of somePage.jsp for
>>>> regular browsers and somePageMobile.jsp for a mobile device (there will
>>>> be
>>>> more complications to this as I'd like to be able to have fine grained
>>>> control based on the user agent so there may be many versions of a jsp
>>>> such
>>>> as somePageWinMobile6_5_htc.jsp).
>>>>
>>>> There are couple of ways I can think of to do this, but they're ugly:
>>>> - JSP level logic to render the page differently - dont want it, I'd
>>>> rather
>>>> individual jsp's for each supported device (or family) as this allows
>>>> developers who are working on targeting a site to a specific device to
>>>> concentrate on that device.
>>>> - Tiles template level logic - again not ideal as I would like to be able
>>>> to
>>>> use specific templates for device types.
>>>>
>>>> Better but not perfect would be some sort of post action result modifying
>>>> interceptor such that in the struts.xml I could define a number of
>>>> different
>>>> result mappings such as success, success_winmob, success_blackberry_storm
>>>> and have the result string that has been returned from the action
>>>> (success)
>>>> modified by some sort of interceptor (e.g. appending the suffix prior to
>>>> struts mapping it off to a view) - the filter itself could be configured
>>>> as
>>>> to whether or not to alter result strings based on the action and the
>>>> user
>>>> device. - Is it possible to modify the result string post action but
>>>> prior
>>>> to struts resolving the mapping? And if so would I have access to the the
>>>> name of the action?
>>>>
>>>> Any suggestions here are greatly appreciated!
>>>> Web technologies being used are Struts2, Tiles2 and JSP.
>>>>
>>>> Regards,
>>>> Marcus
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: user-unsubscribe@(protected)
>>>> For additional commands, e-mail: user-help@(protected)
>>>>
>>>>
>>>>
>>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-unsubscribe@(protected)
>>> For additional commands, e-mail: user-help@(protected)
>>>
>>>
>>>
>>> __________ NOD32 4817 (20100129) Information __________
>>>
>>> This message was checked by NOD32 antivirus system.
>>> http://www.eset.com
>>>
>>>
>>>
>>>
>>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@(protected)
>> For additional commands, e-mail: user-help@(protected)
>>
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>
>
> __________ NOD32 4818 (20100129) Information __________
>
> This message was checked by NOD32 antivirus system.
> http://www.eset.com
>
>
>
>

Attachment:
user_204892.ezm (zipped)I admit that I haven't read the whole thread, so flame me if you
covered the answer already, but...
Have you looked at Sitemesh? I would suggest look at creating
different decorators for each of the devices you want to support, then
code your undecorated JSPs so that they can be decorated based on the
device accessing it. Sitemesh has a ton of different ways you can pick
the decorator, so I would imagine you'd be able to find a way to
abstract the decorator picking logic outside of your business logic.
Then, the advantage of the decorator pattern is that you can code your
UI screens and business logic once and just have the screens decorated
differently based on the abstracted decorator picking logic. (As a
bonus, you can add new decorators for new devices without changing
much)
-Wes
--
Wes Wannemacher
Head Engineer, WanTii, Inc.
Need Training? Struts, Spring, Maven, Tomcat...
Ask me for a quote!

Attachment:
user_204883.ezm (zipped)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

Attachment:
user_204885.ezm (zipped)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&${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-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>

Attachment:
user_204886.ezm (zipped)Sorry the line result should be like this:
<result name="success" type="redirectAction"
>
s>test/CompleteConfirmation.action?orderNumbers=${ordernumber1}&orderNumbers=${ordernumber2}&orderNumbers=${ordernumber3}&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&${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-unsubscribe@(protected)
>> For additional commands, e-mail: user-help@(protected)
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>

Attachment:
user_204887.ezm (zipped)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}&orderNumbers=${ordernumber2}&orderNumbers=${ordernumber3}&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&${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-unsubscribe@(protected)
>>> For additional commands, e-mail: user-help@(protected)
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@(protected)
>> For additional commands, e-mail: user-help@(protected)
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>

Attachment:
user_204888.ezm (zipped)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
<torme@(protected):
> 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}&orderNumbers=${ordernumber2}&orderNumbers=${ordernumber3}&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&${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-unsubscribe@(protected)
>>>> For additional commands, e-mail: user-help@(protected)
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-unsubscribe@(protected)
>>> For additional commands, e-mail: user-help@(protected)
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@(protected)
>> For additional commands, e-mail: user-help@(protected)
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>

Attachment:
user_204889.ezm (zipped)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
> <torme@(protected):
>
>> 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}&orderNumbers=${ordernumber2}&orderNumbers=${ordernumber3}&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&${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-unsubscribe@(protected)
>>>>> For additional commands, e-mail: user-help@(protected)
>>>>>
>>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: user-unsubscribe@(protected)
>>>> For additional commands, e-mail: user-help@(protected)
>>>>
>>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-unsubscribe@(protected)
>>> For additional commands, e-mail: user-help@(protected)
>>>
>>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@(protected)
>> For additional commands, e-mail: user-help@(protected)
>>
>>
>>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>

Attachment:
user_204890.ezm (zipped)What you are doing should work the way you expect... I use the Spring
integration all the time :)
A few simple questions, do you have the spring-plugin installed? Do
you have the Spring ContextLoaderListener setup in the web.xml? Do you
have any non-default configuration settings in any of web.xml,
applicationContext.xml or struts.xml? Are you using any plugins other
than the Spring plugin? What version of Spring and Struts are you
using?
-Wes
On Fri, Jan 29, 2010 at 1:19 AM, Miguel <miguelrvs@(protected):
> Hello all,
> I have a problem when using spring and the spring aplication context.
> If I configure the action class directly from struts.conf, my action
> does just the correct behavior. (1)
> But if I configure the action in a spring file and in struts.conf put
> only the spring bean name everything gets piped to the input result
> (the prepare method is executed, but not the action method).(2)
> I would benefit if the second scenario worked, because in the spring
> configuration is quite complex and have more than one bean of the same
> type
>
> (1) <action name="receptor_*" method="{1}"
> class="com.fcm.sectorPrimario2009.ui.ReceptorAction"> (struts.conf)
>
> (2) <action name="receptor_*" method="{1}" class="receptorSPAction">
> (struts.conf)
>
> <bean id="receptorSPAction"
> class="com.fcm.sectorPrimario2009.ui.ReceptorAction"
> scope="prototype"> (spring.xml)
> <property name="receptorDAO"><ref
> local="receptorDAOSectorPrimario"/></property>
> </bean>
>
> I hope someone can help me
>
>
>
>
> Si quieres ser más positivo, pierde un electrón
> Miguel Ruiz Velasco Sobrino
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>
--
Wes Wannemacher
Head Engineer, WanTii, Inc.
Need Training? Struts, Spring, Maven, Tomcat...
Ask me for a quote!

Attachment:
user_204893.ezm (zipped)Hi,
Thanks for answering!!
I'll post my relevant configurations. I'm using spring 2.5.6 and struts 2.1.8.1.
I have the spring plugin in the struts.conf, and my actions are
correctly autowired by name.
I also have an include in struts.conf where the relevant action is called.
The thing here is I have two beans of the same type but configured to
access different hibernate entity-names (a DAO), and in the part that
misbehaves, i need to access the second one that has a different name,
but is of the same type.
When I make spring instanciate the action, the prepare() method in the
action is called correctly, and it uses the autowired DAO, it gets the
desired data but the details() method is not called and the result is
automatically redirected to INPUT result.
When I make struts (using the spring factory( instanciate the action,
the prepare() method in the action is called correctly, and it uses
the autowired DAO, it gets the desired data, the details() method is
called and the result is shown correctlly.
Curiosly the browse method is correctly called en each config.
The thing here is I have replicated some part of the system, and I
have identical class names in different packages (the code in the
classes is not the same), and those classes are called from different
urls in struts.conf. The action has no validators but it's twin class
in a different package does.
struts.conf:
<constant name="struts.devMode" value="true" />
<constant name="struts.objectFactory"
value="
org.apache.struts2.spring.StrutsSpringObjectFactory" />
<constant name="struts.freemarker.templatesCache" value="true" />
<package name="proyectox" extends="json-default" ><!-- struts-default -->
<!-- Si no le pones este stack, pues no funciona...-->
<interceptors>
<interceptor name="strutsSpring"
class="com.proyectox.ui.interceptor.HibernateOpenSessionInViewInterceptor"/>
<interceptor-stack name="strutsSpringPPPStack">
<interceptor-ref name="strutsSpring"/>
<interceptor-ref name="paramsPrepareParamsStack"/>
</interceptor-stack>
</interceptors>
<include file="com/fcm/sectorPrimario2009/sectorPrimario.struts.xml"/>
....
com/fcm/sectorPrimario2009/sectorPrimario.struts.xml:
<package name="receptorsectorprimario" extends="proyectox"
namespace="/sectorprimario/receptor">
<action name="lista" method="browse"
class="com.fcm.sectorPrimario2009.ui.ReceptorAction">
<result>listaReceptor.jsp</result>
<result name="error">listaReceptor.jsp</result>
<interceptor-ref name="scope">
<param name="session">contribuyente</param>
<param name="autoCreateSession">true</param>
<param name="key">contribuyenteActual</param>
</interceptor-ref>
<interceptor-ref name="strutsSpringPPPStack"/>
</action>
<action name="receptor_*" method="{1}"
class="com.fcm.sectorPrimario2009.ui.ReceptorAction">
<result>receptorDetail.jsp</result>
<result name="detail">receptorDetail.jsp</result>
<result name="input">receptorNuevo.jsp</result>
<result name="modificar">receptorNuevo.jsp</result>
<result name="borrar" type="redirectAction">
<param name="actionName">lista</param>
</result>
<result name="error">/error.jsp</result>
<interceptor-ref name="scope">
<param name="session">contribuyente</param>
<param name="autoCreateSession">true</param>
<param name="key">contribuyenteActual</param>
</interceptor-ref>
<interceptor-ref name="scope">
<param name="session">receptor</param>
<param name="autoCreateSession">true</param>
<param name="key">receptorActualSP</param>
</interceptor-ref>
<interceptor-ref name="strutsSpringPPPStack"/>
</action>
...
sectorPrimario.spring.xml:
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jee="http://www.springframework.org/schema/jee"
xmlns:sec="http://www.springframework.org/schema/security"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:aop="http://www.springframework.org/schema/aop"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/jee
http://www.springframework.org/schema/jee/spring-jee-2.5.xsd
http://www.springframework.org/schema/security
http://www.springframework.org/schema/security/spring-security-2.0.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
"
default-autowire="autodetect">
<bean id="receptorDAOSectorPrimario"
class="com.fcm.sectorPrimario2009.dao.ReceptorDAOImpl">
<property name="sessionFactory" ref="sessionFactory" />
<property name="entityName" value="SP_Receptor"/>
</bean>
<bean id="cfdDAOSectorPrimario" class="com.proyectox.DAO.CfdDAOImpl">
<property name="sessionFactory" ref="sessionFactory" />
<property name="relName" value="SP_FACTURA"/>
<property name="toXML" ref="toXML" />
<property name="contribuyenteDAO" ref="contribuyenteDAO" />
<property name="impuestosDAO" ref="impuestosDAO" />
<property name="repository">
<bean class="com.fcm.repository.Nom151RepositoryAdaptor">
<property name="repository" ref="nom151Repository"/>
</bean>
</property>
</bean>
<bean id="receptorSPAction"
class="com.fcm.sectorPrimario2009.ui.ReceptorAction"
scope="prototype">
<property name="receptorDAO"><ref
local="receptorDAOSectorPrimario"/></property>
</bean>
ReceptorAction.java
public class ReceptorAction extends ActionSupport implements Preparable {
private static final long serialVersionUID = 4361713845701104303L;
...
public void prepare() throws Exception {
// msg = pais+" Pais: "+pais.getNombre()+" idobt: "+id;
if ((receptor == null && id != null) || (receptor != null && id !=
null && receptor.getId() != id)){
receptor = (ReceptorPrimario)receptorDAO.find(id);
}
else if (receptor == null && id == null){
receptor = new ReceptorPrimario();
}
@
org.apache.struts2.interceptor.validation.SkipValidation public String browse(){
// receptores = receptorDAO.findAll();
receptores = receptorDAO.findByContribuyente(contribuyente);
if (receptores == null ){
msg ="Algo funciono mal";
return ERROR;
}
if(receptores.size() ==0){
msg="No hay receptores";
return SUCCESS;
}
return SUCCESS;
}
@
org.apache.struts2.interceptor.validation.SkipValidation public String detail(){
if (receptor == null)
return ERROR;
// msg = id.toString();
// msg = "detail de persona fisica "+receptor;
return "detail";
}
...
}
web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID"
version="2.5">
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
<display-name>ProyectoX app</display-name>
<resource-ref>
<res-ref-name>jdbc/DB</res-ref-name>
<res-type>
javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
<resource-ref>
<description>
Resource reference to a factory for
javax.mail.Session instances that may be used for sending electronic mail
messages, preconfigured to connect to the appropriate SMTP
server.
</description>
<res-ref-name>mail/Session</res-ref-name>
<res-type>
javax.mail.Session</res-type>
<res-auth>Container</res-auth>
</resource-ref>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
classpath:spring.cfg.xml
</param-value>
</context-param>
<context-param>
<param-name>log4jConfigLocation</param-name>
<param-value>/WEB-INF/classes/log4j.xml</param-value>
</context-param>
<filter>
<filter-name>springSecurityFilterChain</filter-name>
<filter-class>
org.springframework.web.filter.DelegatingFilterProxy</filter-class>
</filter>
<filter-mapping>
<filter-name>springSecurityFilterChain</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<listener>
<listener-class>org.springframework.security.ui.session.HttpSessionEventPublisher</listener-class>
</listener>
<filter>
<filter-name>struts2</filter-name>
<filter-class>
org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
</web-app>
In past projects I have made the same trick of making spring
instanciate actions, and this is the first time I have this behavior.
In the other project, I use the same spring version, but struts 2.1.6,
and the struts.conf has not includes. I'll test it without includes to
see if the error appears or not.
Thanks for your help.
Si quieres ser más positivo, pierde un electrón
Miguel Ruiz Velasco Sobrino
On Fri, Jan 29, 2010 at 14:27, Wes Wannemacher <wesw@(protected):
> What you are doing should work the way you expect... I use the Spring
> integration all the time :)
>
> A few simple questions, do you have the spring-plugin installed? Do
> you have the Spring ContextLoaderListener setup in the web.xml? Do you
> have any non-default configuration settings in any of web.xml,
> applicationContext.xml or struts.xml? Are you using any plugins other
> than the Spring plugin? What version of Spring and Struts are you
> using?
>
> -Wes
>
> On Fri, Jan 29, 2010 at 1:19 AM, Miguel <miguelrvs@(protected):
>> Hello all,
>> I have a problem when using spring and the spring aplication context.
>> If I configure the action class directly from struts.conf, my action
>> does just the correct behavior. (1)
>> But if I configure the action in a spring file and in struts.conf put
>> only the spring bean name everything gets piped to the input result
>> (the prepare method is executed, but not the action method).(2)
>> I would benefit if the second scenario worked, because in the spring
>> configuration is quite complex and have more than one bean of the same
>> type
>>
>> (1) <action name="receptor_*" method="{1}"
>> class="com.fcm.sectorPrimario2009.ui.ReceptorAction"> (struts.conf)
>>
>> (2) <action name="receptor_*" method="{1}" class="receptorSPAction">
>> (struts.conf)
>>
>> <bean id="receptorSPAction"
>> class="com.fcm.sectorPrimario2009.ui.ReceptorAction"
>> scope="prototype"> (spring.xml)
>> <property name="receptorDAO"><ref
>> local="receptorDAOSectorPrimario"/></property>
>> </bean>
>>
>> I hope someone can help me
>>
>>
>>
>>
>> Si quieres ser más positivo, pierde un electrón
>> Miguel Ruiz Velasco Sobrino
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@(protected)
>> For additional commands, e-mail: user-help@(protected)
>>
>>
>
>
>
> --
> Wes Wannemacher
>
> Head Engineer, WanTii, Inc.
> Need Training? Struts, Spring, Maven, Tomcat...
> Ask me for a quote!
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>

Attachment:
user_204891.ezm (zipped)I don't know if I'd go too far creating a TypeConverter... Can you
just do something like this -
<s:if test="%{your.boolean.property}">Y</s:if><s:else>N</s:else>
Really, you could probably create a .tag file out of it and reuse it
easier than creating a Type Converter.
-Wes
On Fri, Jan 29, 2010 at 7:48 AM, RogerV <roger.varley@(protected):
>
> Hi
>
> I have a collection of objects, each one contains a boolean flag, and I'm
> displaying these via a JSP as a list via an interator. Struts is converting
> the boolean fields into the strings "true" and "false", I'd like to be able
> to
>
> 1) display them as "Y" and "N"
> 2) convert back to "true" and "false" when the list is returned
> 3) and do it via annotation if possible.
>
> Having read http://struts.apache.org/2.0.11.1/docs/type-conversion.html it
> looks that a custom TypeConvertor is the way to proceed.
>
> Is it possible to create a TypeConvertor that extends the existing Boolean
> convertor to return "Y","N" instead of "true", "false"? Where do I find the
> convertor or is it a "built-in" function? Is it possible to do the override
> via annotation so that I can execute the override where I need it and
> default to the standard convertor where I don't.
>
> Regards
> --
> View this message in context: http://old.nabble.com/Boolean-Type-Conversion-tp27371490p27371490.html
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>
--
Wes Wannemacher
Head Engineer, WanTii, Inc.
Need Training? Struts, Spring, Maven, Tomcat...
Ask me for a quote!

Attachment:
user_204894.ezm (zipped)Hello,
I have the following configuration in a Struts.xml file. The
paramsPrepareParamsStack is the default interceptor stack. AccountAction
does not implement any interfaces. Both BankcardAction and ECheckAction
implement Preparable and ModelDriven.
<action name="account"
class="com.epa.actions.AccountAction">
<result name="bankcard_browse" type="redirectAction">
<param name="action">bankcard_browse</param>
</result>
<result name="echeck_browse" type="redirectAction">
<param name="action">echeck_browse</param>
</result>
</action>
<action name="bankcard_*" method="{1}"
class="com.epa.actions.BankcardAction" >
<result name="success">bankcarddetail.tile</result>
<result name="input">bankcarddetail.tile</result>
</action>
<action name="echeck_*" method="{1}"
class="com.epa.actions.ECheckAction" >
<result name="success">echeckdetail.tile</result>
<result name="input">echeckdetail.tile</result>
</action>
Below is the execute method from AccountAction class..
public String execute() {
String actionName = "bankcard_browse";
if (StringUtils.equalsIgnoreCase(recordType, "EC")) {
actionName = "echeck_browse";
}
return actionName;
}
In my testing I get the error - No result defined for action
com.epa.actions.AccountAction and result bankcard_browse. I can navigate
straight to bankcard_browse (not going through AccountAction) without
incident. If I try to go to AccountAction first and redirect to
bankcard_browse or echeck_browse I get the error. What am I doing wrong?
I'm using Struts 2 version 2.1.8.1., Tiles 2.0.6, OGNL 2.7.3. I hope I've
included enough information. Any help will be greatly appreciated as I've
been struggling with this problem for too long.
Best regards,
Rob
Rob_26@(protected)