struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From daveck <d...@holstein.com>
Subject Re: Newbie to Struts 2 - Question about Interceptors
Date Fri, 01 Feb 2008 19:29:11 GMT

I ended up solving the problem using an Interceptor and saving the parameter
Map to the session.

session.setAttribute("input_params", request.getParameterMap();

Then in my action I implemented SessionAware and utililized BeanUtils from
Jakarta Commons to re-populate the properties in my action class.

this.setRequestMap((Map)this.getSession().get("input_parms"));
BeanUtils.populate(this, this.getRequestMap();

Thank you for your help.
David




Laurie Harper wrote:
> 
> daveck wrote:
>> Hello,
>> I need to put up a "Confirmation Screen" in between my input jsp and my
>> success jsp.
>> 
>> byproduct.action -> byproduct-input.jsp
>> byproduct-input.jsp -> confirm.jsp
>> (If yes...)
>> confirm.jsp -> byproduct.action
>> byproduct.action -> byproduct-success.action
>> 
>> Is there a Struts 2 way to carry the input parameters across the
>> confirm.jsp
>> so the second call to byproduct.action has access to them?
>> 
>> I've looked at the ChainInterceptor and ActionChaining and have a feeling
>> the solution resides there, but could use a little help.  I hope I was
>> clear
>> enough... :)
>> 
>> Thanks!
> 
> The short answer is no, not without intervention from you. You will need 
> to arrange yourself for the data submitted from byproduct-input.jsp to 
> be carried over so that it's available to byproduct.action.
> 
> Two ways to do that are:
> 
> 1) place an action between byproduct-input.jsp and confirm.jsp which 
> saves the submitted data into an object stored in the session, then 
> retrieve that object in byproduct-success.action
> 
> 2) place hidden fields in confirm.jsp that correspond to the inputs in 
> byproduct-input.jsp, populating them from the request parameters. Make 
> sure that confirm.jsp calls byproduct.action using a form submit (not 
> just a link) so that the data in the hidden inputs gets sent.
> 
> You should probably be submitting byproduct-input.jsp to an action 
> anyway, so that you can perform validation and/or expose any additional 
> data that confirm.jsp might need but, other than that, the main thing 
> affecting which approach you choose is whether you want to use or avoid 
> the session.
> 
> HTH,
> 
> L.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Newbie-to-Struts-2---Question-about-Interceptors-tp15230274p15231887.html
Sent from the Struts - User mailing list archive at Nabble.com.


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


Mime
View raw message