problem with server-side validation in struts
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   trinity_trinity
Posted On:   Monday, July 21, 2003 03:46 PM

hello, i am new to this technology and i am trying to figure out what is wrong with my code. I want server side validations. in the struts-config.xml i have an action mapping and bean mapping such as this type="com.freechilly.network.user.GenericUserProfileForm"/> type="com.freechilly.network.user.NetworkUserSaveAction" name="genericUserProfileForm" scope="request" validate="true" input="/networkUserProfile.jsp"> The networkUserProfile.jsp displays a form of type genericUserProfileForm and i have ment   More>>

hello,

i am new to this technology and i am trying to figure out what is wrong with my code. I want server side validations.



in the struts-config.xml i have an action mapping and bean mapping such as this






type="com.freechilly.network.user.GenericUserProfileForm"/>








type="com.freechilly.network.user.NetworkUserSaveAction"
name="genericUserProfileForm"
scope="request"
validate="true"
input="/networkUserProfile.jsp">








The networkUserProfile.jsp displays a form of type genericUserProfileForm and i have mentioned






under the body tag.
also the form tag is







In the genericUserProfileForm (which extends from ValidatorForm) I have overridden the validate function






public ActionErrors validate(ActionMapping mapping, HttpServletRequest request)
{




ActionErrors errors = super.validate(mapping, request);




if (!password.equals(verifyPassword)) {



errors.add("password2",



new ActionError("error.password.match"));



}
System.out.println("errors are-------->"+ errors.size());



return errors;



}





the validator has to just check for username. and the validation.xml has the following addition

















When i do a javascript check, i get the errors displayed. but when i do the server side check, the errors are not displayed. When i click submit, i get a blank page.... LOL!!
does anyone have any idea...or some suggestions as to where i might be making a mistake.....really appreciate your help.


thanks    <<Less
About | Sitemap | Contact