Tim-

any reason why you would'nt put the attributes in Session by implementing 
SessionAware
http://struts.apache.org/2.0.14/docs/how-do-we-get-access-to-the-session.html

put them in with setSession() and access with Map parameters=this.getSession()

http://struts.apache.org/2.0.14/struts2-core/apidocs/org/apache/struts2/interceptor/SessionAware.html

Martin 
______________________________________________ 
Disclaimer and confidentiality note 
Everything in this e-mail and any attachments relates to the official business 
of Sender. This transmission is of a confidential nature and Sender does not 
endorse distribution to any party other than intended recipient. Sender does 
not necessarily endorse content contained within this transmission. 




> Date: Mon, 2 Mar 2009 14:32:50 -0500
> From: to...@genome.med.harvard.edu
> To: user@struts.apache.org
> Subject: Best Practices for Forms
> 
> Hello All,
> 
> I'm relatively new to Struts 2 and have a few questions as far as how to lay 
> out a form correctly.
> 
> I have the following scenario:
> 
> 1. User is presented a form. (addData.jsp)
> 2. User submits form, we go off to an action to add form information to the 
> database. (SubmitData.action)
> 3. We send the user to a page that displays information about the data they 
> just entered. (viewData.jsp)
> 
> The problem I was initially having was that, after step 2, I was using the 
> dispatcher result type to send the user to their view. SubmitData.action was 
> providing viewData.jsp with the necessary stack 
> values to fill in the page with the appropriate data.
> 
> This was problematic, because at this point, due to the forward, the browser 
> was still at SubmitData.action, and refreshing the view caused the data to be 
> submit again. To fix this, I tried changing 
> the result type to redirect to the jsp page instead. This fixed the problem 
> of the user refreshing the page. The browser was now at viewData.jsp, so 
> refreshing the page didn't submit the data again.
> 
> However, because I had redirected, I no longer had the value stack the 
> SubmitData.action provided, so I arrived at the view with no data. I can come 
> up with ways to work around this, but none of them 
> feel right. For instance, I can pass the necessary keys to viewData.jsp 
> result like so:
> 
> <action name="SubmitData" class="action.SubmitDataAction">
>       <result name="success">/viewData.jsp?dataId=%{dataId}</result>
> </action>
> 
> And then in the jsp page have action tags which gather the correct objects 
> and put them on the stack:
> 
> <s:action name="GetData" namespace="/" var="data">
>       <s:param name="dataId" value="%{dataId}" />
> </s:action>
> 
> But again, this seems messy. What do people recommend? I know this has got to 
> be a very frequent case, I'm just not sure the best way to handle it.
> 
> Thanks,
> Tim
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
> 

_________________________________________________________________
Windows Live™ Contacts: Organize your contact list. 
http://windowslive.com/connect/post/marcusatmicrosoft.spaces.live.com-Blog-cns!503D1D86EBB2B53C!2285.entry?ocid=TXT_TAGLM_WL_UGC_Contacts_032009

Reply via email to