Thank you,
Though I have little experience in web development I was aware of that, but
I avoided using
sessions due to the fact that a user could open multiple tabs in a browser
and issue multiple
requests that would belong to the same session. So if he tried to refresh an
older request this
would return him the results of a newer request (because last request
parameters would be
saved in session) causing confusion to the user.

On Wed, May 5, 2010 at 12:06 PM, Alex Rodriguez Lopez <
alo...@flordeutopia.pt> wrote:

> Hi,
>
> you can store data in session and retrieve it later on. Data stored in
> session is persisted through requests.
>
> ActionContext.getContext().getSession();
>
>
> http://struts.apache.org/2.1.8.1/struts2-core/apidocs/com/opensymphony/xwork2/ActionContext.html
>
>
>  Hi,
>>
>> I have an issue in my code that I can't resolve and I would appreciate
>> your
>> help.
>> I am using the struts2 execAndWait interceptor when I submit a form on my
>> site.
>> Below is the relevant struts.xml snippet
>>
>>    <interceptor-stack name="loadingStack">
>>             <interceptor-ref name="defaultStack" />
>>             <interceptor-ref name="execAndWait" />
>>     </interceptor-stack>
>>
>>     <action name="ProcessTripForm" class="actions.ProcessTripForm">
>>             <interceptor-ref name="loadingStack"></interceptor-ref>
>>             <result name="input">/jsp/unscheduled.jsp</result>
>>             <result name="success" type="chain">ProcessTrips</result>
>>             <result name="wait">/jsp/wait.jsp</result>
>>     </action>
>>
>>     <action name="ProcessTrips"
>>             class="actions.ProcessTrips">
>>             <result name="success">/jsp/results.jsp</result>
>>             <result
>> name="noFilteredResults">/jsp/emptyFilteredResults.jsp</result>
>>             <result name="none">/jsp/no_results.jsp</result>
>>     </action>
>>
>> The problem I have, is that when I submit my form via POST and produce
>> some results then if I try to refresh the results page (results.jsp) those
>> data previously
>> send via POST do not exist anymore, so I'm redirected to the wait page and
>> finally because data do not exist to an error page (that does not happen
>> in
>> Firefox where data somehow are preserved in refresh). Obviously data are
>> erased
>> the first time the wait page is auto-refreshed. FYI here is a simplified
>> version
>> of my wait.jsp
>>
>> <html xmlns="http://www.w3.org/1999/xhtml";>
>>
>> <head>
>>   <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
>>   <meta http-equiv="refresh" content="3;<s:url includeParams="all"/>"/>
>>
>>   <title>Wait Page</title>
>> </head>
>>
>> <body>
>>
>>  <div>
>>   <p>Waiting...</p>
>>  </div>
>>
>> </body>
>> </html>
>>
>> I could solve this problem by using includeParams="all" in s:url (as seen
>> above) when
>> refreshing wait page but then the data are seen in the URL (aside the fact
>> that there is
>> a ton of data).Also, when data are not latin characters then after the
>> first
>> refresh the
>> character encoding in URL fails, so cannot be used later for repeating the
>> request with
>> refresh (e.g. ProcessTripForm.action?originCity=Ηράκλειο is becoming after
>> the first
>> refresh
>> ProcessTripForm.action?originCity=%26%23xCE%3B%26%23x97%3B%26%23xCF%3B
>> %26%23x81%3B%26%23xCE%3B%26%23xAC%3B and continues to expand).
>>
>> My question is how can I preserve data when I use the execAndWait
>> interceptor and use a
>> POST request in a way that when I'm on result page and hit refresh the
>> same
>> request will
>> be repeated?
>> If that is not possible, and I have the data on my URL via GET and
>> includeParams then what
>> do I have to do so encoding does not fail ?
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>
>

Reply via email to