• 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

Model attribute null pointer exception  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
Sorry guys not to spam the forum. But new question new post right? So as said in my previous post changing commandname solved the setter not found issue.
Since you apparently can't use form:checkbox as a parameter I changed my jsp and controller;
this us how they look now:
controller:

and jsp:

but now my user is causing a nullpointer?
 
Marshal
Posts: 67197
169
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The stack trace will pinpoint the line where the NPE occurs. Without that, it's simply guesswork.
 
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
the first time I use the user generated from my form, that why I thought that my modelAttribute is generating the nullpointer
I used a Sys.out to print the toString of the user and this is the result:
id=0, userName='null', email='null', password='null', repeat='null', gender=M
 
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 noticed that my gender was filled in correctly ,so if I change the parameters of my postMethod to: it works, but do I really need to request each parameter separately?
 
It's just like a fortune cookie, but instead of a cookie, it's pie. And we'll call it ... 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!