jsp中使用基路径
更新日期:
基路径的使用问题
在jsp中使用基路径base href
1 | <%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %> |
a标签中的路径 href=”test” 则访问 http://localhost:8080/动态获取项目名/test
推荐使用
a标签中的路径 href=”/test” 则访问 http://localhost:8080/test
不使用base href
一
a标签中的路径 href=”test” 则访问 当前路径的相对路径
例如当前路径 http://localhost:8080/项目名/duty/duty.html
则访问 http://localhost:8080/项目名/duty/test
因此该种方式不推荐使用
二
a标签中的路径 href=”/test” 则访问 http://localhost:8080/test
在项目直接部署在根路径下可以使用,即不使用项目名