jsp.项目名称等
1、资料:在jsp页面中获取项目名称 - wjt276--Java - ITeye博客.html(https://wjt276.iteye.com/blog/455112)
el表达式:${pageContext.request.contextPath}
1.1、ZC:我的测试代码:
<% System.out.println("request.getContextPath() : "+request.getContextPath()); System.out.println("request.getScheme() : "+request.getScheme()); System.out.println("request.getServerName() : "+request.getServerName()); System.out.println("request.getServerPort() : "+request.getServerPort()); String path = request.getContextPath(); String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; System.out.println("basePath : "+basePath); %>
控制台 输出:
request.getContextPath() : /DingYueHao request.getScheme() : http request.getServerName() : localhost request.getServerPort() : 8080 basePath : http://localhost:8080/DingYueHao/
2、
3、
4、
5、
6、