You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by "Chung, Sean Saehoon" <se...@cisco.com> on 2004/05/04 03:42:04 UTC

Turbine/Velocity - Back Button displays Page has Expired

Hello all,
 
I am building an application using Turbine/Velocity.
 
It looks like when an application is secured (by defining security related
elements in web.xml), using BACK button of IE generates :
 
Warning: Page has Expired 
The page you requested was created using information you submitted in a
form. This page is no longer available. As a security precaution, Internet
Explorer does not automatically resubmit your information for you. 

To resubmit your information and view this Web page, click the Refresh
button. 
 
 
 
Now from here user can press REFRESH button on the browser to get to the
previous page, but I am trying to see if there is a work around for having
to press back and then refresh.
 
By looking at the fact that this doesn't happen (ie just back button will
take a user to previous page) when an application is not protected (no
security related elements defined in web.xml) and I guess this problem is to
do with authentication somehow?.
 
Has anyone dealt with this issue before?
 
Thanks in advance
Sean

Re: Turbine/Velocity - Back Button displays Page has Expired

Posted by Brian Lawler <br...@tribenetwork.com>.
David-

On May 5, 2004, at 2:19 PM, David Demner wrote:

> Hi Stephane,
>
> Interesting...  How do you get this work 'elegantly' in turbine?  
> Right now,
> my data entry forms are processed by Actions, but when I use 
> setTemplate
> from within the action, I get to the presentation page I want, but 
> when I
> click on Refresh it asks to resending the data.  How are you doing 
> this?
>

On our project we have a single action base class (that extends 
velocity action) that is responsible for handling the redirect.  The 
trick is that the "action" argument is not passed via 
$link.setAction().  Rather, we include it as a hidden field in form 
itself.  Then, the action attribute of the <form> tag is just the next 
screen in the flow with no action specifiers.  On the back end, we use 
the request header (data.getRequest()) to get the requested url (which 
the browser puts into the HTTP request header) and we redirect to that 
page upon successful completion of the form processing.  Our actions 
don't know the difference.  The only time this gets tricky is when then 
next page of your flow requires parameters that weren't known until 
completed the action on the back end.  In this case, you have to add 
those additional parameters to the requested url at the end of the 
action and send the redirect via data.setRedirectURI().

-Brian


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


RE: Turbine/Velocity - Back Button displays Page has Expired

Posted by Stephane James Vaucher <va...@cirano.qc.ca>.
That's the problem, you need to encode it in your redirect url like:

http://.../display.vm?messageid=loginok&msgparam=bar

This way, a refresh will return the same response.

sv

On Thu, 6 May 2004, David Demner wrote:

> Brian and Stephane,
> 
> Redirecting seems to work in terms of not allowing the user to 'refresh' and
> repost the form data.
> 
> The problem I'm having now is the messages (set by data.setMessage()) are
> being lost.  So, I'm not sure how to provide feedback to the users...  Any
> ideas?
> 
> Thanks again,
> 
> David
> 
> -----Original Message-----
> From: Stephane James Vaucher [mailto:vauchers@cirano.qc.ca] 
> Sent: Thursday May 6, 2004 10:19 AM
> To: Turbine Users List
> Subject: RE: Turbine/Velocity - Back Button displays Page has Expired
> 
> 
> As far as I know, there is no turbine module included in turbine to handle 
> your flow as there is in struts.
> 
> You can however send http redirects back to the user. These will tell the 
> browser that the page has moved and it should use the new page (of course 
> the server has already processed the post request/action).
> 
> Here is some sample code of how to do a redirect to be executed after you 
> handle the request and want to redirect the client.
> 
> public void redirect(RunData data, String page) throws Exception {
>     TemplateLink    tl = new TemplateLink(data);
>     tl.setPage(page);
> 
>     // tells the browser where to get the new page
>     data.setRedirectURI(tl.getURI()); 
>     // tells the browser page has moved
>     data.setStatusCode(302); 
> }
> 
> HTH,
> sv
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: turbine-user-help@jakarta.apache.org
> 


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


RE: Turbine/Velocity - Back Button displays Page has Expired

Posted by David Demner <tu...@demner.com>.
Brian and Stephane,

Redirecting seems to work in terms of not allowing the user to 'refresh' and
repost the form data.

The problem I'm having now is the messages (set by data.setMessage()) are
being lost.  So, I'm not sure how to provide feedback to the users...  Any
ideas?

Thanks again,

David

-----Original Message-----
From: Stephane James Vaucher [mailto:vauchers@cirano.qc.ca] 
Sent: Thursday May 6, 2004 10:19 AM
To: Turbine Users List
Subject: RE: Turbine/Velocity - Back Button displays Page has Expired


As far as I know, there is no turbine module included in turbine to handle 
your flow as there is in struts.

You can however send http redirects back to the user. These will tell the 
browser that the page has moved and it should use the new page (of course 
the server has already processed the post request/action).

Here is some sample code of how to do a redirect to be executed after you 
handle the request and want to redirect the client.

public void redirect(RunData data, String page) throws Exception {
    TemplateLink    tl = new TemplateLink(data);
    tl.setPage(page);

    // tells the browser where to get the new page
    data.setRedirectURI(tl.getURI()); 
    // tells the browser page has moved
    data.setStatusCode(302); 
}

HTH,
sv



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


RE: Turbine/Velocity - Back Button displays Page has Expired

Posted by Stephane James Vaucher <va...@cirano.qc.ca>.
As far as I know, there is no turbine module included in turbine to handle 
your flow as there is in struts.

You can however send http redirects back to the user. These will tell the 
browser that the page has moved and it should use the new page (of course 
the server has already processed the post request/action).

Here is some sample code of how to do a redirect to be executed after you 
handle the request and want to redirect the client.

public void redirect(RunData data, String page) throws Exception {
    TemplateLink    tl = new TemplateLink(data);
    tl.setPage(page);

    // tells the browser where to get the new page
    data.setRedirectURI(tl.getURI()); 
    // tells the browser page has moved
    data.setStatusCode(302); 
}

HTH,
sv

On Wed, 5 May 2004, David Demner wrote:

> Hi Stephane,
> 
> Interesting...  How do you get this work 'elegantly' in turbine?  Right now,
> my data entry forms are processed by Actions, but when I use setTemplate
> from within the action, I get to the presentation page I want, but when I
> click on Refresh it asks to resending the data.  How are you doing this?
> 
> Thanks!
> 
> DAvid
> 
> -----Original Message-----
> From: Stephane James Vaucher [mailto:vauchers@cirano.qc.ca] 
> Sent: Wednesday May 5, 2004 1:29 PM
> To: Turbine Users List
> Subject: Re: Turbine/Velocity - Back Button displays Page has Expired
> 
> 
> I think it's probably a questing of the browser interpretation of 
> the semantics of the http method you are using.
> 
> I don't want to sound pedantic, but a post implies posting information 
> while a get implies retrieving information. If you want the info to be 
> shown using back, you should use a get, not a post. In general, when I use 
> a post, I redirect afterwards to the presentation page that can be 
> refreshed. This is to prevent my app from allowing double submissions with 
> refreshes, and protects me from browser specific behaviour.
> 
> sv
> 
> On Tue, 4 May 2004, Chung, Sean Saehoon wrote:
> 
> > Hello all,
> >  
> > I am building an application using Turbine/Velocity.
> >  
> > It looks like when an application is secured (by defining security related
> > elements in web.xml), using BACK button of IE generates :
> >  
> > Warning: Page has Expired 
> > The page you requested was created using information you submitted in a
> > form. This page is no longer available. As a security precaution, Internet
> > Explorer does not automatically resubmit your information for you. 
> > 
> > To resubmit your information and view this Web page, click the Refresh
> > button. 
> >  
> >  
> >  
> > Now from here user can press REFRESH button on the browser to get to the
> > previous page, but I am trying to see if there is a work around for having
> > to press back and then refresh.
> >  
> > By looking at the fact that this doesn't happen (ie just back button will
> > take a user to previous page) when an application is not protected (no
> > security related elements defined in web.xml) and I guess this problem is
> to
> > do with authentication somehow?.
> >  
> > Has anyone dealt with this issue before?
> >  
> > Thanks in advance
> > Sean
> > 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: turbine-user-help@jakarta.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: turbine-user-help@jakarta.apache.org
> 


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


RE: Turbine/Velocity - Back Button displays Page has Expired

Posted by David Demner <tu...@demner.com>.
Hi Stephane,

Interesting...  How do you get this work 'elegantly' in turbine?  Right now,
my data entry forms are processed by Actions, but when I use setTemplate
from within the action, I get to the presentation page I want, but when I
click on Refresh it asks to resending the data.  How are you doing this?

Thanks!

DAvid

-----Original Message-----
From: Stephane James Vaucher [mailto:vauchers@cirano.qc.ca] 
Sent: Wednesday May 5, 2004 1:29 PM
To: Turbine Users List
Subject: Re: Turbine/Velocity - Back Button displays Page has Expired


I think it's probably a questing of the browser interpretation of 
the semantics of the http method you are using.

I don't want to sound pedantic, but a post implies posting information 
while a get implies retrieving information. If you want the info to be 
shown using back, you should use a get, not a post. In general, when I use 
a post, I redirect afterwards to the presentation page that can be 
refreshed. This is to prevent my app from allowing double submissions with 
refreshes, and protects me from browser specific behaviour.

sv

On Tue, 4 May 2004, Chung, Sean Saehoon wrote:

> Hello all,
>  
> I am building an application using Turbine/Velocity.
>  
> It looks like when an application is secured (by defining security related
> elements in web.xml), using BACK button of IE generates :
>  
> Warning: Page has Expired 
> The page you requested was created using information you submitted in a
> form. This page is no longer available. As a security precaution, Internet
> Explorer does not automatically resubmit your information for you. 
> 
> To resubmit your information and view this Web page, click the Refresh
> button. 
>  
>  
>  
> Now from here user can press REFRESH button on the browser to get to the
> previous page, but I am trying to see if there is a work around for having
> to press back and then refresh.
>  
> By looking at the fact that this doesn't happen (ie just back button will
> take a user to previous page) when an application is not protected (no
> security related elements defined in web.xml) and I guess this problem is
to
> do with authentication somehow?.
>  
> Has anyone dealt with this issue before?
>  
> Thanks in advance
> Sean
> 


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


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


Re: Turbine/Velocity - Back Button displays Page has Expired

Posted by Stephane James Vaucher <va...@cirano.qc.ca>.
I think it's probably a questing of the browser interpretation of 
the semantics of the http method you are using.

I don't want to sound pedantic, but a post implies posting information 
while a get implies retrieving information. If you want the info to be 
shown using back, you should use a get, not a post. In general, when I use 
a post, I redirect afterwards to the presentation page that can be 
refreshed. This is to prevent my app from allowing double submissions with 
refreshes, and protects me from browser specific behaviour.

sv

On Tue, 4 May 2004, Chung, Sean Saehoon wrote:

> Hello all,
>  
> I am building an application using Turbine/Velocity.
>  
> It looks like when an application is secured (by defining security related
> elements in web.xml), using BACK button of IE generates :
>  
> Warning: Page has Expired 
> The page you requested was created using information you submitted in a
> form. This page is no longer available. As a security precaution, Internet
> Explorer does not automatically resubmit your information for you. 
> 
> To resubmit your information and view this Web page, click the Refresh
> button. 
>  
>  
>  
> Now from here user can press REFRESH button on the browser to get to the
> previous page, but I am trying to see if there is a work around for having
> to press back and then refresh.
>  
> By looking at the fact that this doesn't happen (ie just back button will
> take a user to previous page) when an application is not protected (no
> security related elements defined in web.xml) and I guess this problem is to
> do with authentication somehow?.
>  
> Has anyone dealt with this issue before?
>  
> Thanks in advance
> Sean
> 


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