This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Spring and the fly likes Problem with @PathVariable in Spring 3 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "Problem with @PathVariable in Spring 3 " Watch "Problem with @PathVariable in Spring 3 " New topic
Author

Problem with @PathVariable in Spring 3

Justin Howard
Ranch Hand

Joined: Feb 19, 2009
Posts: 162
Hi All,

I am trying to use Spring 3 MVC framework.
I am having trouble mapping the below code to the request.

When I use just @RequestMapping(value="/research/listResearch.html") it works fine.

I get a 404 The requested resource (/marketingforms/research/listResearch.html/10) is not available.

Am I missing any configuration?

Thanks
Justin Howard
Ranch Hand

Joined: Feb 19, 2009
Posts: 162
Hi All,

Is there any information I am missing ?

Thanks
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

If you've mapped the DispatcherServlet to *.html, I don't think this is going to work. I don't remember seeing urls like that. Usually, the filename comes last. You could have something like /research/{status}/listResearch.html instead.


[My Blog]
All roads lead to JavaRanch
Justin Howard
Ranch Hand

Joined: Feb 19, 2009
Posts: 162
I apologize for the late reply. I did not get a notification for your reply.

But you are correct. The @Pathvariable works perfectly with the URL format you privided.

Since this had not worked for me earlier I implemented it in a different way.

 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Problem with @PathVariable in Spring 3
 
Similar Threads
EMail Adresses and Spring Controller methods
How to redirect another page with value object fron ajax request
Persisting request variables beyond pageContext
Spring in Action Book Question - An expert opinion
Spring 3 @PathVariable problem with slash