Skip to content

Access URI template variables in view [SPR-6486] #11152

@spring-projects-issues

Description

@spring-projects-issues

Rich Kroll opened SPR-6486 and commented

I have a URI template in the form of "/hotels/{hotel}/bookings/{booking}", and can access the path variables in the controller via @PathVariable, but when building links in the view I need a reference to the different path variables.

As an example, let's say the user requests "/hotels/Hotelier/bookings/booking-123", and as is a common use case in the view, there is a need to link back to the bookings listing "/hotels/Hotelier/bookings/". The only way currently to access the URI template variables is to manually inject them each time into the view. I suggest that a tag be created that is capable of building a link from the same URI template style that is used in the @RequestMapping, something like <spring:a link="/hotels/{hotel}">go</spring:a>.


Affects: 3.0 M1, 3.0 M2, 3.0 M3, 3.0 M4, 3.0 RC1, 3.0 RC2, 3.0 RC3

Issue Links:

7 votes, 6 watchers

Metadata

Metadata

Assignees

Labels

in: webIssues in web modules (web, webmvc, webflux, websocket)type: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions