关于javaweb访问路径问题(不全,会慢慢补充)

前台-》后台:

${pageContext.request.contextPath}/redirct/first

后台-》前台:
1.全路径:

		String path = request.getScheme()+"://"+request.getServerName() 
		+":"+request.getServerPort()+request.getContextPath()+ "/";

2./项目名:

String path = request.getContextPath();

3.客户端路径:给浏览器用的

带“/”:相对于主机,如:localhost:8080/
不带“/”:开发中一定不要出现这种情况,代表从当前目录找

4.服务器端路径:

带“/”:相对于项目,如:localhost:8080/project/

猜你喜欢

转载自blog.csdn.net/weixin_43075298/article/details/85334913
今日推荐