1、在前端的页面中设置超链接或者js或者css等,都会涉及到url,所以url的设计有三种格式:在资源名称前面有/、无/、…/;例如:/abc.action、abc.action、…/abc.action
三种格式分别要补齐完整的url路径,
/:补齐到8080:,及端口的位置
例如:<!-- 表示绝对路径:此时表示的是8080/位置
http://localhost:8080/bcd.action -->
<a href="/bcd.action">提交</a>
无:补齐时要看当前浏览器地址栏url 的情况
<!-- 超链接没有/,表示相对路径,前面补齐的是当前浏览器上面地址里url中去掉名称剩下的前面部分
假如:当前的url是http://localhost:8080/day07-springmvc-url/index.jsp,那么就把index.jsp去掉之后剩下的
http://localhost:8080/day07-springmvc-url/abc.action
假如:当前的url是http://localhost:8080/day07-springmvc-url/file/index.jsp,那么吧index.jsp去掉剩下
http://localhost:8080/day07-springmvc-url/file/abc.action-->
<a href="abc.action">提交</a>
第三种补齐时要看浏览器地址栏的url,只不过要根据url进行向前找路径情况
<!-- 表示相对路径,../表示从当前url的资源名称部分向前找两级目录,找到的第二级目录的url,给其补齐 -->
<!-- 超链接没有/,表示相对路径,前面补齐的是当前浏览器上面地址里url中去掉名称剩下的前面部分
假如:当前的url是http://localhost:8080/day07-springmvc-url/index .jsp,那么找两级之后8080/位置
http://localhost:8080/cde.action
假如:当前的url是http://localhost:8080/day07-springmvc-url/file/index.jsp,那么找两级之后day07-springmvc-url/位置
http://localhost:8080/day07-springmvc-url/cde.action -->
<a href="../cde.action">提交</a>
3、后台在设置url的时候,一般采用绝对路径,后台的绝对路径是包含项目名的
//表示到项目名位置的url,例如:http://localhost:8080/day07-springmvc-url/
//后台的/表示项目名路径
@RequestMapping("/abc.action")//此时带有/所以补齐的url中带有项目名
完整格式是http://localhost:8080/day07-springmvc-url/abc.action