-
Notifications
You must be signed in to change notification settings - Fork 38.8k
Closed
Labels
in: webIssues in web modules (web, webmvc, webflux, websocket)Issues in web modules (web, webmvc, webflux, websocket)type: enhancementA general enhancementA general enhancement
Milestone
Description
Keith Donald opened SPR-7543 and commented
It'd be nice instead of having to do this:
@RequestMapping(value="/edit/{slug}", method=RequestMethod.GET)
public String getEditAppForm(@PathVariable String slug, Account account, Model model) {
model.addAttribute(connectedAppRepository.getAppForm(account.getId(), slug));
model.addAttribute("slug", slug);
return "develop/apps/edit";
}
... and using ${slug} in my template to access the @PathVariable
value, I could simply do:
@RequestMapping(value="/edit/{slug}", method=RequestMethod.GET)
public String getEditAppForm(@PathVariable String slug, Account account, Model model) {
model.addAttribute(connectedAppRepository.getAppForm(account.getId(), slug));
return "develop/apps/edit";
}
and reference something automatically exposed like ${pathVars.slug} in my template.
Affects: 3.0.4
Issue Links:
- Access URI template variables in view [SPR-6486] #11152 Access URI template variables in view ("duplicates")
- Need a way to disable behavior added in "Automatically expose @PathVariables in the Model" SPR-7543 [SPR-8749] #13391 Need a way to disable behavior added in "Automatically expose
@PathVariables
in the Model" SPR-7543 - Use AbstractView instead of HandlerMethodArgumentResolver to add @PathVariable values to the model [SPR-8484] #13130 Use AbstractView instead of HandlerMethodArgumentResolver to add
@PathVariable
values to the model
Referenced from: commits ed9d9a4
Metadata
Metadata
Assignees
Labels
in: webIssues in web modules (web, webmvc, webflux, websocket)Issues in web modules (web, webmvc, webflux, websocket)type: enhancementA general enhancementA general enhancement