Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

<s:fielderror/> is not display error mybrowser

 
Piraba Sivakadadcham
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All;

Its my issue:

Validate method not working propely in struts2

Action class validate methos is:
public void validate(){
if(getUser().getUsername().length() == 0){
System.out.println("inside the error username error");
addActionMessage("User Name is required");
}

if(getUser().getPassword().length() == 0){
addActionMessage("Password is required");
}

if(getUser().getPassword().length() > 6){
addActionMessage( "Minimum passsword length is 6");
}

System.out.println("###########" + this.hasActionMessages());
}


In jsp

<s:fielderror/>
<s:actionmessage/>
<div id="result">Submit form bellow.</div>
<s:form action="accountTypeAction" >

<s:textfield name="user.username" label="Email" required="true" />

<!-- <s:textfield name="confirmEmail" key="label.confirmmail" size="20" /> -->

<s:password name="user.password" label="Password" required="true"/>

<!-- <s:password name="cpassword" key="label.confirmpassword" /> -->


Please anybody help me soon please

S.Piraba
error.JPG
[Thumbnail for error.JPG]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic