Uploaded image for project: 'Spring Framework'
  1. Spring Framework
  2. SPR-5779

Allow links to @Controller methods from views without hardcoding URLs

    Details

    • Type: New Feature
    • Status: Closed
    • Priority: Major
    • Resolution: Complete
    • Affects Version/s: 3.0 M3
    • Fix Version/s: 4.1 RC1
    • Component/s: Web
    • Labels:
      None

      Description

      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

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                rstoya05-aop Rossen Stoyanchev
                Reporter:
                cherro Chris Herron
                Last updater:
                St├ęphane Nicoll
              • Votes:
                32 Vote for this issue
                Watchers:
                29 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Days since last comment:
                  3 years, 50 weeks, 6 days ago