You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Alec C4 <al...@gmail.com> on 2008/05/09 01:05:17 UTC

struts 2.1.2 - strange bug

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?
-- 
View this message in context: http://www.nabble.com/struts-2.1.2---strange-bug-tp17138404p17138404.html
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: struts 2.1.2 - strange bug

Posted by Joachim Rohde <ma...@joachimrohde.com>.
Hi,

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@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org