|
View:
New views
2 Messages
—
Rating Filter:
Alert me
|
|
|
struts 2.1.2 - strange bugHi, all.
I have a config with <action name="Registration"> <result>/pages/register.jsp</result> </action> <action name="Register" class="UserAction"> <result>/pages/result.jsp</result> <result name="input">/pages/register.jsp</result> </action> action with public String execute() { userManager.registerUser(getEmail(), getPassword()); return SUCCESS; } public void validate() { if (getEmail().length() == 0) { addFieldError("email", getText("user.registration.errors.no.email")); } if (getPassword().length() == 0) { addFieldError("password", getText("user.registration.errors.no.password")); } if (getPasswordConfirmation().length() == 0) { addFieldError( "passwordConfirmation", getText("user.registration.errors.no.password.confirmation")); } } and jsp register.jsp with <s:form action="Register"> <s:textfield name="email" label="email"/> <s:password name="password" label="password"/> <s:password name="passwordConfirmation" label="password confirmation"/> <s:submit /> </s:form> but, when i'm trying to submit zero-form i'm of course see FieldError messages, but when i'm pressing submit button again - i see double amount of same messages, again - triple amount ... and i cannot understand - why i see too much same messages? |
|
|
Re: struts 2.1.2 - strange bugHi,
you are using spring, aren't you? If so, you have to set the scope of your bean in the applicationContext.xml to "prototype" (or setting the attribute "singleton" to "false", depending on the version of spring you are using). Joachim Alec C4 schrieb: > Hi, all. > I have a config with > > <action name="Registration"> > <result>/pages/register.jsp</result> > </action> > <action name="Register" class="UserAction"> > <result>/pages/result.jsp</result> > <result name="input">/pages/register.jsp</result> > </action> > > action with > > public String execute() { > userManager.registerUser(getEmail(), getPassword()); > return SUCCESS; > } > > public void validate() { > if (getEmail().length() == 0) { > addFieldError("email", getText("user.registration.errors.no.email")); > } > if (getPassword().length() == 0) { > addFieldError("password", > getText("user.registration.errors.no.password")); > } > if (getPasswordConfirmation().length() == 0) { > addFieldError( > "passwordConfirmation", > getText("user.registration.errors.no.password.confirmation")); > } > } > > and jsp register.jsp with > > <s:form action="Register"> > <s:textfield name="email" label="email"/> > <s:password name="password" label="password"/> > <s:password name="passwordConfirmation" label="password confirmation"/> > <s:submit /> > > </s:form> > > > but, when i'm trying to submit zero-form i'm of course see FieldError > messages, but when i'm pressing submit button again - i see double amount of > same messages, again - triple amount ... and i cannot understand - why i see > too much same messages? --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@... For additional commands, e-mail: user-help@... |
| Free Forum Powered by Nabble | Forum Help |