struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yoge <yogend...@adventnet.com>
Subject Re: Token Help Neede
Date Mon, 03 May 2004 10:38:38 GMT
Hi Richie ,

include below line in the jsp that contains the form(AA in your case)
<%@ page import="org.apache.struts.util.TokenProcessor" %>
<%
    TokenProcessor token = TokenProcessor.getInstance();
    token.saveToken(request);   
%>

This should be included before <html:form> tag. You should use 
<html:form> in the data entry JSP file

Do a isValidToken check in Action1 before inserting into the data into 
DB. If false then redirect to the error page .

No need for any token check in Action2

Hope this helps.

Thanks
Yoge



shankarr wrote:

> Hi!
> I have an issue in my web application.
> My control flow is as follows :
> 1. On cliking a link, show Page AA as a result of ForwardAction
> 2. User fills data in AA and then clicks submit button.
> 3. This submit button internally invokes my Action class Action1 which 
> adds data to db  and  calls class Action2 to retrieve data from db
> 4. Action2 as a result of processing invokes Page BB
>
> Now, when the user sees Page BB and if he clicks refresh on the 
> browser, one more object gets added to db.
>
> I have read through all the token related mails and some examples but 
> still not able to get it.
>
> Need help.
>
> Please tell step by step procedure. I try the following :
>
> 1. Put saveToken(request) in Action class A1
> 2. In class A2 make check if isValidToken(request).
> If valid, then process data and at the end reset(request)
>
> 3. But it fails at the step2 mentioned above. Always says invalid 
> token and gives blank page.
>
>
> Many thanks,
>
> Richie
>
>
>
>
>

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


Mime
View raw message