Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript 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
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

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

 
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.
 
Rancher
Posts: 1170
18
IntelliJ IDE Hibernate Firefox Browser MySQL Database Spring Tomcat Server Java
  • 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
Rancher
Posts: 1170
18
IntelliJ IDE Hibernate Firefox Browser MySQL Database Spring Tomcat Server Java
  • 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?
 
I can't beleive you just said that. Now I need to calm down with this tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic