I'm not sure if I should post this here, in the spring- or in the jspforum, since I'm using all three, but anyways...
I've cretead a registerform, in the same way I have done numerious of times, but suddently when getting the form I get an error that he can't find the setterMethod for my form
I always bind the form to the entity in my getMethod and that used to work.
I never got this error before, and I'm not sure what's causing it, so any tips are welcome.
Daniel Demesmaecker wrote:At least it's a lot shorter
An even easier method is to not bother trying to see if you were given a valid e-mail address. Even if you could do that, there's still the problem of whether the user is going to read e-mails sent to that address. To me the latter is what you really want to know.
1) Use a private static final Pattern. Pattern is immutable so you don't need to create the same pattern multiple times.
2) If you use constraint annotations on your User class, annotate the method argument with @Valid, and add a method argument of type Errors, you don't need to do all this validation yourself. You can then also use @Email to do the email validation.
I know about @Email, but I tried it before and it dosn't work. It throws an error, but didnt show the message to the user, it logged it and printed on the console which is kinda useless. The pattern I changed, but the validation still isnt what it should be, something@gmail is vallid, what it shouldnt be, so I might follow Paulus advice and leave the responsebillity to the user. I use a constrain on my password top, the password should at least be 5chars and contain special tijdens and capitals, that seems to work. For @Valid i read on stack not to use it when using modelAttribute ?
It's good to be able to use someting, it's better to understand how it works.
Always look on the bright side of life. At least this ad is really tiny: