aspose file tools*
The moose likes Spring and the fly likes Getting (Restful) Path Parameters in Spring MVC 3 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "Getting (Restful) Path Parameters in Spring MVC 3" Watch "Getting (Restful) Path Parameters in Spring MVC 3" New topic
Author

Getting (Restful) Path Parameters in Spring MVC 3

Dan King
Ranch Hand

Joined: Mar 18, 2009
Posts: 84
Is it possible to: set a URI template in the mvc:view-controller element of the *-servlet.xml file and then use/get that path parameter in a jsp (alternatively, is there another method with the same result)? An example follows:

*-servlet.xml:


home.jsp:


Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17257
    
    6

Well, you can in Controller code with @PathVariable.

Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
Dan King
Ranch Hand

Joined: Mar 18, 2009
Posts: 84
Mark Spritzler wrote:Well, you can in Controller code with @PathVariable.

Mark


I understand that using @PathVariable in a controller method will give me access to the path parameter in that controller method. But how can I gain access to the path parameter in the jsp?
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17257
    
    6

Dan King wrote:
Mark Spritzler wrote:Well, you can in Controller code with @PathVariable.

Mark


I understand that using @PathVariable in a controller method will give me access to the path parameter in that controller method. But how can I gain access to the path parameter in the jsp?


I don't know, but have you tried just using the variable name directly like?

${myPathVariableName}

I would assume, if it can be done, that is how it would be done. Just making a guess here.

Mark
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Getting (Restful) Path Parameters in Spring MVC 3