• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

tokens and validations are not playing well

 
Hussein Baghdadi
clojure forum advocate
Bartender
Posts: 3479
Clojure Mac Objective C
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi.
I'm imploying Struts transaction tokens in order to prevent the user from submitting register form twice.

registerForm is a sub class of ValidatorForm.
The problem is when I type /action/register.do?operation=load
I got register.jsp page which is full of validation errors and Struts generated tokens is not included in the page.
How over come this problem (without turning off the validation) ?
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by John Todd:
The problem is when I type /action/register.do?operation=load
I got register.jsp page which is full of validation errors

That's just the problem: When you type in an Action URI, none of the fields have been populated, so naturally validation is going to fail. If you're planning on calling this action both from a URI and from a form submit, you need to define two separate action mappings. They can both refer to the same action class, and have basically the same settings, but they must each have a different path name. The one you call from a URI should specify validate="false" and the one you call from a form submission should specify validate="true". Example:

[ February 14, 2007: Message edited by: Merrill Higginson ]
 
Hussein Baghdadi
clojure forum advocate
Bartender
Posts: 3479
Clojure Mac Objective C
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think DispatchAction will not fit in this situation, right ?
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, DispatchAction would not fit this situation.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic