Meaningless Drivel is fun!
The moose likes Spring and the fly likes Getting error when submitting form using SpringMVC and REST Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "Getting error when submitting form using SpringMVC and REST" Watch "Getting error when submitting form using SpringMVC and REST" New topic
Author

Getting error when submitting form using SpringMVC and REST

James Dekker
Ranch Hand

Joined: Dec 09, 2006
Posts: 221
Hello there,

Created an online form in JSP using SpringMVC tag libraries. The controller for my form is a RESTful web service.

The RESTful web service has two calls:

(1) http://localhost:8080/myapp/applications/new

This brings up the online form in the browser (this works).

(2) http://localhost:8080/myapp/applications/create

This saves the form data to a database (handles submit). This is where it breaks.

Followed the conventions from the sample demo petclinic app which comes with the Spring Framework.

Online form:



The RESTful web service which serves as form controller:



Exception thrown when I click on submit:



Does anyone know why I am getting this exception?

Would really appreciate it if someone could help me with this issue...

Happy programming and thank you for taking the time to read this.
James Dekker
Ranch Hand

Joined: Dec 09, 2006
Posts: 221
Found the solution!

It was a RESTEasy problem... The fix was putting the @Form Application App inside the parameter list and prepending the domain model object's setters with @FormParam("name").

Source: Integrating RESTEasy with SpringMVC
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Getting error when submitting form using SpringMVC and REST
 
It's not a secret anymore!