Spring:url not resolving links correctly

后端 未结 4 2081
执笔经年
执笔经年 2021-02-06 18:22

I\'m pretty new to the Spring framework and web applications, though I\'m experienced with Java. When I run my site on a local tomcat server the URL is: http://localhost:8

4条回答
  •  [愿得一人]
    2021-02-06 19:01

    It is good practice to put all your links as follows

     Other site 
    

    ${pageContext.servletContext.contextPath} always gives your application root, when you are developing use http://localhost:8080/myApp, then your application root is /myapp, but when you want to place your application in production generally your application root will be /, using ${pageContext.servletContext.contextPath} before links you ensure it will work in both cases

提交回复
热议问题