• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Bear Bibeault
  • Knute Snortum
  • Liutauras Vilda
Sheriffs:
  • Tim Cooke
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Ron McLeod
  • Ganesh Patekar
  • salvin francis
Bartenders:
  • Tim Holloway
  • Carey Brown
  • Stephan van Hulst

Can't find setterMethod for [commandName]  RSS feed

 
Master Rancher
Posts: 920
17
Firefox Browser Hibernate IntelliJ IDE Java MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • 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
Master Rancher
Posts: 920
17
Firefox Browser Hibernate IntelliJ IDE Java MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nevermind... I read that commandName is depricated and I should use modelAtribute instead, that solved that issue
 
Saloon Keeper
Posts: 2268
290
Android Angular Framework Eclipse IDE Java Linux MySQL Database Redhat TypeScript
  • Mark post as helpful
  • send pies
  • 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
Master Rancher
Posts: 920
17
Firefox Browser Hibernate IntelliJ IDE Java MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • 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
 
Sheriff
Posts: 23968
50
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • 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
Master Rancher
Posts: 920
17
Firefox Browser Hibernate IntelliJ IDE Java MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • 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
Sheriff
Posts: 23968
50
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • 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: 21556
100
Chrome Eclipse IDE Java Spring Ubuntu VI Editor Windows
  • Mark post as helpful
  • send pies
  • 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
Master Rancher
Posts: 920
17
Firefox Browser Hibernate IntelliJ IDE Java MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • 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 ?
 
I’m tired of walking, and will rest for a minute and grow some wheels. This is the promise of this tiny ad:
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database
https://coderanch.com/t/704633/RavenDB-Open-Source-NoSQL-Database
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!