This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
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 EJB 3 in Action this week in the EJB and other Java EE Technologies 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: 17249
    
    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: 17249
    
    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
 
Similar Threads
Problem running app under Tomcat v7
window.open()
Need Spring 3.0 help with annotations/setup
que in spring mvc - simpleformcontroller
Problem finding index page under WEB-INF / Spring MVC