File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Getting (Restful) Path Parameters in Spring MVC 3

 
Dan King
Ranch Hand
Posts: 84
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 17276
6
IntelliJ IDE Mac Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, you can in Controller code with @PathVariable.

Mark
 
Dan King
Ranch Hand
Posts: 84
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 17276
6
IntelliJ IDE Mac Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic