You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by semog12 <se...@gmail.com> on 2013/12/05 19:39:09 UTC
Token Session Interceptor and back button
Hi,
I am using the token session interceptor for a form and I have this
situation:
1) I am in the form page;
2) I leave the form page;
3) Go back to the form page by the "back" button;
4) Submit the form;
And of course the form is not submitted and the token returns
"invalid.token" but do not adds no actionError. It will not be interesting
to add an action error?
Ok, I can resend to a page with a message but I already have a error page
that presents the action errors when necessary.
Thanks,
André Gomes
--
View this message in context: http://struts.1045723.n5.nabble.com/Token-Session-Interceptor-and-back-button-tp5714861.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
Antwort: Re: Token Session Interceptor and back button
Posted by Christoph Nenning <Ch...@lex-com.net>.
Hi,
> I am using tiles to create my web pages and when I put your code on the
main
> template it works perfectly but when I put on the tiles attribute page
do
> not work.
Yes, that is because you cannot set response headers after you have
started to create a response body.
When Tiles has started to create HTML that is exactly what happens.
I suggest you set those headers in an own interceptor instead of in JSPs.
That is what we do in our applications.
Here is an wiki article on how to write own interceptors:
http://struts.apache.org/development/2.x/docs/writing-interceptors.html
regards,
Christoph
Von: semog12 <se...@gmail.com>
An: user@struts.apache.org,
Datum: 09.12.2013 13:04
Betreff: Re: Token Session Interceptor and back button
Hi,
Thank for the replies but when I was trying your solution I encounter
another situation.
I am using tiles to create my web pages and when I put your code on the
main
template it works perfectly but when I put on the tiles attribute page do
not work.
Works like this:
But does not work like this:
page_head.jsp:
Thanks,
André Gomes
--
View this message in context:
http://struts.1045723.n5.nabble.com/Token-Session-Interceptor-and-back-button-tp5714861p5714880.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
This Email was scanned by Sophos Anti Virus
Re: Token Session Interceptor and back button
Posted by semog12 <se...@gmail.com>.
Hi,
Thank for the replies but when I was trying your solution I encounter
another situation.
I am using tiles to create my web pages and when I put your code on the main
template it works perfectly but when I put on the tiles attribute page do
not work.
Works like this:
But does not work like this:
page_head.jsp:
Thanks,
André Gomes
--
View this message in context: http://struts.1045723.n5.nabble.com/Token-Session-Interceptor-and-back-button-tp5714861p5714880.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
Re: Token Session Interceptor and back button
Posted by Paul Benedict <pb...@apache.org>.
You need to have browser caching disabled on your first page:
response.setHeader("Cache-Control", "no-cache, no-store, must-revalidate");
// HTTP 1.1
response.setHeader("Pragma", "no-cache"); // HTTP 1.0
response.setDateHeader("Expires", 0); // Proxies
On Fri, Dec 6, 2013 at 5:03 AM, Miguel Almeida <mi...@almeida.at> wrote:
> Paul, I was thinking about this example...what did you have in mind as a
> way to achieve that, tough, i.e., that a browser "back" refreshes the
> page?
>
> I can only see some javascript method/hack for that. Were you thinking
> of something else?
>
>
> Miguel
>
> On Thu, 2013-12-05 at 14:59 -0600, Paul Benedict wrote:
>
> > Make sure your back-button action refreshes the page. You can't reuse a
> > token from the browser's cache. It needs to regenerated.
> >
> >
> > On Thu, Dec 5, 2013 at 12:39 PM, semog12 <se...@gmail.com> wrote:
> >
> > > Hi,
> > >
> > > I am using the token session interceptor for a form and I have this
> > > situation:
> > > 1) I am in the form page;
> > > 2) I leave the form page;
> > > 3) Go back to the form page by the "back" button;
> > > 4) Submit the form;
> > >
> > > And of course the form is not submitted and the token returns
> > > "invalid.token" but do not adds no actionError. It will not be
> interesting
> > > to add an action error?
> > >
> > > Ok, I can resend to a page with a message but I already have a error
> page
> > > that presents the action errors when necessary.
> > >
> > > Thanks,
> > >
> > > André Gomes
> > >
> > >
> > >
> > > --
> > > View this message in context:
> > >
> http://struts.1045723.n5.nabble.com/Token-Session-Interceptor-and-back-button-tp5714861.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
> > >
> > >
> >
> >
>
>
>
--
Cheers,
Paul
Re: Token Session Interceptor and back button
Posted by Miguel Almeida <mi...@almeida.at>.
Paul, I was thinking about this example...what did you have in mind as a
way to achieve that, tough, i.e., that a browser "back" refreshes the
page?
I can only see some javascript method/hack for that. Were you thinking
of something else?
Miguel
On Thu, 2013-12-05 at 14:59 -0600, Paul Benedict wrote:
> Make sure your back-button action refreshes the page. You can't reuse a
> token from the browser's cache. It needs to regenerated.
>
>
> On Thu, Dec 5, 2013 at 12:39 PM, semog12 <se...@gmail.com> wrote:
>
> > Hi,
> >
> > I am using the token session interceptor for a form and I have this
> > situation:
> > 1) I am in the form page;
> > 2) I leave the form page;
> > 3) Go back to the form page by the "back" button;
> > 4) Submit the form;
> >
> > And of course the form is not submitted and the token returns
> > "invalid.token" but do not adds no actionError. It will not be interesting
> > to add an action error?
> >
> > Ok, I can resend to a page with a message but I already have a error page
> > that presents the action errors when necessary.
> >
> > Thanks,
> >
> > André Gomes
> >
> >
> >
> > --
> > View this message in context:
> > http://struts.1045723.n5.nabble.com/Token-Session-Interceptor-and-back-button-tp5714861.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
> >
> >
>
>
Re: Token Session Interceptor and back button
Posted by Paul Benedict <pb...@apache.org>.
Make sure your back-button action refreshes the page. You can't reuse a
token from the browser's cache. It needs to regenerated.
On Thu, Dec 5, 2013 at 12:39 PM, semog12 <se...@gmail.com> wrote:
> Hi,
>
> I am using the token session interceptor for a form and I have this
> situation:
> 1) I am in the form page;
> 2) I leave the form page;
> 3) Go back to the form page by the "back" button;
> 4) Submit the form;
>
> And of course the form is not submitted and the token returns
> "invalid.token" but do not adds no actionError. It will not be interesting
> to add an action error?
>
> Ok, I can resend to a page with a message but I already have a error page
> that presents the action errors when necessary.
>
> Thanks,
>
> André Gomes
>
>
>
> --
> View this message in context:
> http://struts.1045723.n5.nabble.com/Token-Session-Interceptor-and-back-button-tp5714861.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
>
>
--
Cheers,
Paul