• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Can't find setterMethod for [commandName]

 
Rancher
Posts: 1171
18
IntelliJ IDE Hibernate Firefox Browser MySQL Database Spring Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.

My Jsp:

My UserClass:

My ControllerCass:

My Stacktrace:
 
Daniel Demesmaecker
Rancher
Posts: 1171
18
IntelliJ IDE Hibernate Firefox Browser MySQL Database Spring Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Nevermind... I read that commandName is depricated and I should use modelAtribute instead, that solved that issue
 
Marshal
Posts: 4491
572
VSCode Eclipse IDE TypeScript Redhat MicroProfile Quarkus Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Daniel Demesmaecker wrote:


That's a gnarly looking regex expression.  Did you know that it evaluates coderanch@gmail as a valid email address?
 
Daniel Demesmaecker
Rancher
Posts: 1171
18
IntelliJ IDE Hibernate Firefox Browser MySQL Database Spring Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I haven't written it myself...
it comes from here, who got it from there.
I was to lazy to write my own and it's so long and messy that I didn't feel like improving it.
This one better?

At least it's a lot shorter
 
Marshal
Posts: 28177
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
Daniel Demesmaecker
Rancher
Posts: 1171
18
IntelliJ IDE Hibernate Firefox Browser MySQL Database Spring Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
even if he's not reading the emails, he'll still need a way to recover his password when it's lost... If he dosn't read that mail, it's his prob, I did my part...
 
Paul Clapham
Marshal
Posts: 28177
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Daniel Demesmaecker wrote:If he dosn't read that mail, it's his prob.



Exactly. That's why I advocate not spending any time on checking the user's e-mail address.
 
Sheriff
Posts: 22781
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Some more tips:

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.
 
Daniel Demesmaecker
Rancher
Posts: 1171
18
IntelliJ IDE Hibernate Firefox Browser MySQL Database Spring Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ?
 
reply
    Bookmark Topic Watch Topic
  • New Topic