On Mon, Jun 09,'03 (08:39 AM GMT+0500), Riyaz wrote: 
  
> 1) is there a sample application which demonstrates using tokens in
> struts?

Actually I didn't find the Struts example app using the token stuff too
well. Maybe the example has changed though since it's been a while since
I looked at, but way back when I didn't find it too helpful.

Here's how I use it....

In your action or dispatch that is called right before you end up
fowarding to your form you do this:

 saveToken( request );

Then in your action that is doing your save/update you need to check
that this token is valid so that you don't have a duplicate
update/insert... so you do...


if ( isTokenValid( request ) ) {
                //do your save/update whatever
                bean.save();
                //reset the token
                resetToken(ae.getReq());
                //save new token back in request
                saveToken(ae.getReq() );
            }
else // save an error message that they are trying a duplicate entry by
hitting refresh, forward to an error page or back to the form

I'm not sure if the above it the way other people, smarter than myself,
do it, but it works for me.

  
> 2) i'm not using the struts html tag library to display forms or form
> controls. would this be a problem? would i have to do extra work if
> so?

Like David said, you'll have to do this manually if you don't use the
form tag. Use the form tag! (Why aren't you using it??:)


-- 
Rick


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to