• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Spring 3 Newbie Question

 
Mike London
Ranch Hand
Posts: 1158
1
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a JSP where I have defined a <FORM> tag with an input text field and a button to "Search".
So, when I click Submit, I see in the URL: " http://localhost:8080/MyApp/search".

In the controller for this JSP, I set up a @RequestMapping(value = "/search")
Then I have other code to do MAV actions.

-----

The problem is that when I submit the JSP, although the URL in the browser reads: http://localhost:8080/MyApp/search, I am getting the message that the "Request Sent by the Client is syntactically incorrect."

Am I missing something about how to map the JSP to the Controller in Spring 3?

I also tried having something like (method="POST") in the controller method, but that didn't work either.

Thanks in advance for any suggestions.

- Mike
 
Mark Spritzler
ranger
Sheriff
Posts: 17276
6
IntelliJ IDE Mac Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am assuming you have your web.xml DispatcherServlet mapped to MyApp/*?

When you deploy your applicaiton, what does it show in the logs for mapped URLs, it will log out what it has mapped and see if your localhost:8080/MyApp/search is truly mapped.

You might not need the "/" in front of "search" in your @RequestMapping. I always have issues where I have a "/" in front or not.

Mark
 
Mike London
Ranch Hand
Posts: 1158
1
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mark Spritzler wrote:I am assuming you have your web.xml DispatcherServlet mapped to MyApp/*?

When you deploy your applicaiton, what does it show in the logs for mapped URLs, it will log out what it has mapped and see if your localhost:8080/MyApp/search is truly mapped.

You might not need the "/" in front of "search" in your @RequestMapping. I always have issues where I have a "/" in front or not.

Mark



The problem turned out to be how I'd defined the method signature in the controller.

It works now!

Thanks again.

mike
 
Mark Spritzler
ranger
Sheriff
Posts: 17276
6
IntelliJ IDE Mac Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mike London wrote:
Mark Spritzler wrote:I am assuming you have your web.xml DispatcherServlet mapped to MyApp/*?

When you deploy your applicaiton, what does it show in the logs for mapped URLs, it will log out what it has mapped and see if your localhost:8080/MyApp/search is truly mapped.

You might not need the "/" in front of "search" in your @RequestMapping. I always have issues where I have a "/" in front or not.

Mark



The problem turned out to be how I'd defined the method signature in the controller.

It works now!

Thanks again.

mike



Cool.

Mark
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic