This week's book giveaway is in the Go forum.
We're giving away four copies of Head First Go and have Jay McGavren on-line!
See this thread for details.
Win a copy of Head First Go this week in the Go forum!
  • 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
  • Liutauras Vilda
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Devaka Cooray
  • Junilu Lacar
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Tim Holloway
  • Claude Moore
  • Stephan van Hulst
Bartenders:
  • Winston Gutkowski
  • Carey Brown
  • Frits Walraven

how to fix "org.springframework.web. HttpRequestMethodNotSupportedException" ?  RSS feed

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
so this My controller :



so when the following link gets triggered when the form is subbmited  http://localhost:8080/[Project name]/uregistration it gives the following message in console:
and the browser displays a

HTTP 405 Method not allowed error


So how should I fix this ? please help. Also if any other cod eis required please comment below.
 
Master Rancher
Posts: 1162
18
Firefox Browser Hibernate IntelliJ IDE Java MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you show us your registrationController which is mapped to localhost:8080/registration, but you call localhost:8080, so eather call localhost/registration or add an other controller mapped to ("/")
 
Daniel Demesmaecker
Master Rancher
Posts: 1162
18
Firefox Browser Hibernate IntelliJ IDE Java MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you using spring or springBoot?
When it comes to the controllers, you need two of them
First create a home controller, that one is being called when you go to localhost:portnumber or anny of the other mapped urls:


Then make your registrationcontrolle, you're trying to use a ModdelAttribute, but you didn't prepared a model in the getMethod:


Your jsp would then look something like this:


But for next time it would be helpfull if you included a bit more information, for example if you're not using springBoot, include your xml configuration.
Including your User.Class would also be helpfull, you need to provide setters for your instance variables otherwise the binding will fail
I also see you have an implementation of your repository, that not autowired, so I guess ( I shouldn't have to guess, you should tell me)  you're using jdbc?What kinda seems weird to me?
Why not use Spring Data Jpa?
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!