Browsers reload button and url writing
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   jn_dl
Posted On:   Tuesday, August 21, 2001 04:57 AM

Hello,
here is my problem :

JSP1 -> ActionClass1 -> ActionClass2 ->JSP2

When I'm on the JSP2, the url is that of the ActionClass1, so when I hit the reload button, the ActionClass1 is reloaded. (and I would like the ActionClass2 to be reloaded).

How can I do ?

Re: Browsers reload button and url writing

Posted By:   Ted_Husted  
Posted On:   Tuesday, August 21, 2001 08:27 AM

The reload button, by definition, is suppose to resubmit the
last request. In this case, you would not like the last request to
be resubmitted and reprocessed the same way. You would like
ActionClass1 to skip ahead and forward the request to
ActionClass2.


A good strategy to tell if a request has already been
submitted is to use "tokens". Struts supports this directly
with various *token methods in the Action class. To
implement this, you would go back to "ActionClass0"
that lead to JSP1. In this Action, put


saveToken(request) ;

Then in ActionClass1 put a call to


isTokenValid(request) 

If the token is not valid, you would want to forward to
ActionClass2


If it is valid, you would want to finish
the usual processing in ActionClass1 and call


resetToken(request);

to signal that the token has been used.


-Ted.

About | Sitemap | Contact