例如 : http://localhost:8080/projectName/aaa/bbb?name=zhangsan
获取项目名(目录) /projectName
String uri = request.getContextPath();
获取目录下的全名称 /aaa/bbb
String url
= request.getServletPath();

获取当前页面所在服务器的全路径  d:\aaa\webapps\index.jsp
request.getRealPath("index.jsp")

在类中获取绝对路径
A.class.getResource("/").getPath

参考 : http://zjutsoft.iteye.com/blog/1084260

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-04
  • 2021-10-13
  • 2021-07-03
  • 2021-12-15
  • 2021-09-27
猜你喜欢
  • 2021-07-16
  • 2021-08-07
  • 2022-12-23
  • 2022-12-23
  • 2021-05-19
  • 2021-12-12
  • 2022-12-23
相关资源
相似解决方案