bigal
Sep 4th, 2005, 12:21 AM
Hey,
I have a form that has a password field and a confirm password field. I would like my validation code to ensure that both these fields have the same values. Thus, if password = bob and the confirmPassword = ted, validation should fail. I would like to set this up as a common validator rule much like validWhen. Also, because I am anal, I do not want the confirm field to be a property of my bean. For instance, I do not want to have a confirmPassword property in my bean. Thus, in my validation code I would like to validate my bean against other fields in the form that are not associated with my bean. My problem is that I cannot get access to the request in my validator code because spring's validator class doesn't take it as a parameter.
My question is, what is the best way to do this? Should I just make the confirmPassword a property of my bean(I hate this it reminds my of ActionForms). Or is there an easy way to do this in spring? Has anyone else had this problem?
I have a form that has a password field and a confirm password field. I would like my validation code to ensure that both these fields have the same values. Thus, if password = bob and the confirmPassword = ted, validation should fail. I would like to set this up as a common validator rule much like validWhen. Also, because I am anal, I do not want the confirm field to be a property of my bean. For instance, I do not want to have a confirmPassword property in my bean. Thus, in my validation code I would like to validate my bean against other fields in the form that are not associated with my bean. My problem is that I cannot get access to the request in my validator code because spring's validator class doesn't take it as a parameter.
My question is, what is the best way to do this? Should I just make the confirmPassword a property of my bean(I hate this it reminds my of ActionForms). Or is there an easy way to do this in spring? Has anyone else had this problem?