Skip to content

Allow links to @Controller methods from views without hardcoding URLs [SPR-5779] #10449

Closed
@spring-projects-issues

Description

@spring-projects-issues

Chris Herron opened SPR-5779 and commented

The various Spring Web tags and template-URI implementation encourage hard-coding of URLs in the view layer.
If I alter a Controller's URL mapping, I need to remember to go and make the corresponding change(s) in my JSPs so that links and forms aren't broken.
If the spring:url and form:form tags were able to accept the FQCN of a controller bean instead of an actual URL, the tag implementation could determine the most appropriate URL mapping, and (if applicable) incorporate any template-URI params / path variables to generate a reliable URL.
By using the the FQCN, we can rely on any modern IDE to locate references during refactoring, instead of requiring additional help from Spring-aware IDE plugins. IMHO this would fit particularly well with Spring 3.0's annotation-based controller configuration.

Stripes supports this approach:
http://stripes.sourceforge.net/docs/current/taglib/stripes/link.html
http://stripes.sourceforge.net/docs/current/taglib/stripes/form.html


Affects: 3.0 M3

Reference URL: http://forum.springsource.org/showthread.php?t=72284

Issue Links:

Referenced from: commits 6b129c5, 9d479fe

32 votes, 29 watchers

Metadata

Metadata

Assignees

Labels

has: votes-jiraIssues migrated from JIRA with more than 10 votes at the time of importin: 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