RE: Transactional Tokens in the JSP?

2001-05-10 Thread Deadman, Hal

It is saved in a hidden field in the form so it ends up in the request when
you submit.

> -Original Message-
> From: Allen Walker [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, May 10, 2001 11:40 AM
> To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
> Subject: Re: Transactional Tokens in the JSP?
>
>
> At 10:57 AM 5/10/2001 +0200, Jean-Noel Ribette wrote:
> >Allen,
> >
> >You can set the transactional token in your edit Action class with
> >saveToken(request). Then you can test the token in
> >the submit action.
> >
> >I suggest you have a look at the classes EditRegistration and
> >SaveRegistration  in the example application.
>
> Yes, I checked that. But I am wondering how the token get's
> on the request
> from the jsp page itself.
>



Re: Transactional Tokens in the JSP?

2001-05-10 Thread Allen Walker

At 10:57 AM 5/10/2001 +0200, Jean-Noel Ribette wrote:
>Allen,
>
>You can set the transactional token in your edit Action class with 
>saveToken(request). Then you can test the token in
>the submit action.
>
>I suggest you have a look at the classes EditRegistration and 
>SaveRegistration  in the example application.

Yes, I checked that. But I am wondering how the token get's on the request 
from the jsp page itself.




Re: Transactional Tokens in the JSP?

2001-05-10 Thread Jean-Noel Ribette

Allen,

You can set the transactional token in your edit Action class with saveToken(request). 
Then you can test the token in
the submit action.

I suggest you have a look at the classes EditRegistration and SaveRegistration  in the 
example application.

Jean-Noel

- Original Message -
From: Allen Walker <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, May 10, 2001 10:37 AM
Subject: Transactional Tokens in the JSP?


> I would like to use the transaction token logic in the Action class.
> However I am not able to figure out how to place the Transactional Token in
> the JSP so it can be validated against when isTokenValid() is called within
> my Action class. I looked at the Struts source code to find:
>
>  protected boolean isTokenValid(HttpServletRequest request) {
>
>  // Retrieve the saved transaction token from our session
>  HttpSession session = request.getSession(false);
>  if (session == null)
>  return (false);
>  String saved = (String) session.getAttribute(TRANSACTION_TOKEN_KEY);
>  if (saved == null)
>  return (false);
>
>  // Retrieve the transaction token included in this request
>  String token = (String) request.getParameter(Constants.TOKEN_KEY);
>  if (token == null)
>  return (false);
>
>  // Do the values match?
>  return (saved.equals(token));
>
>  }
>
> The Contants class is org.apache.struts.taglib.html.Constants.
>
> Thanks for any help
> -allen-
>
>