Struts: How to generate a token before a form sends to user?

P

PC Leung

Dear all,
When a form firstly displays, the token is invalid.
It becomes valid when the form is re-submitted after
saveToken();

It is because, in struts-example, it demonstrates that
it adds to ActionErrors when a token is invalid.
And the token is always invalid if the form displays
at the first time.

The form will always display error message of invalid token!


Can we do it this way in order to prevent duplicated submission?
When a form firstly displays, the token is valid.
Then user can input and save data. If user submits
again, the token is then invalidated.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top