This week's book giveaway is in the Beginning Java forum.
We're giving away four copies of Get Programming with Java (MEAP only) and have Peggy Fisher on-line!
See this thread for details.
Win a copy of Get Programming with Java (MEAP only) this week in the Beginning Java 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
  • 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

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: 933
17
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: 933
17
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?
 
You'll never get away with this you overconfident blob! The most you will ever get is this tiny ad:
Programmatically Create PDF Using Free Spire.PDF with Java
https://coderanch.com/wiki/703735/Programmatically-Create-PDF-Free-Spire
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!