struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alex Rodriguez Lopez <alo...@flordeutopia.pt>
Subject Re: Struts 2 : redirect to action method on type conversion fail ?
Date Mon, 10 May 2010 09:42:08 GMT
Hi Thomas,

use the paramsPrepareParams interceptor stack (or change yours), from 
struts-default.xml:

<!-- An example of the paramsPrepareParams trick. This stack
                  is exactly the same as the defaultStack, except that it
                  includes one extra interceptor before the prepare 
interceptor:
                  the params interceptor.

                  This is useful for when you wish to apply parameters 
directly
                  to an object that you wish to load externally (such as 
a DAO
                  or database or service layer), but can't load that object
                  until at least the ID parameter has been loaded. By 
loading
                  the parameters twice, you can retrieve the object in the
                  prepare() method, allowing the second params 
interceptor to
                  apply the values on the object. -->
             <interceptor-stack name="paramsPrepareParamsStack">
...

I think this accomplishes what you are looking for (of course you need 
setters for the parameters that you want params interceptor to have 
ready for you by the time the prepare() method is called).

Em 10-05-2010 09:39, Thomas Lulé escreveu:
> That interceptor looks great, but is there any way to access request
> parameters in the prepare() method ?
>
> The http request provides an "archiveProfileId" parameter and I use
> that parameter to load my object "archiveProfile".
>
> 2010/5/10 Lukasz Lenart<lukasz.lenart@googlemail.com>:
>> Use Preparable interface instead
>> http://struts.apache.org/2.x/struts2-core/apidocs/com/opensymphony/xwork2/Preparable.html
>>
>>
>> Regards
>> --
>> Łukasz
>> http://www.lenart.org.pl/
>> Kapituła Javarsovia 2010
>> http://javarsovia.pl
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>


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


Mime
View raw message