一.
String scheme = request.getScheme();//http
String serverName = request.getServerName();//localhost
int port = request.getServerPort();//8080
String context = request.getContextPath();// /demo(项目名称);
String path = scheme+"://"+serverName+":"+port+context+"/"  // http://localhost:8080/demo/
二.
获取上传文件保存服务器的路径
String filePath = request.getSession().getServletContext().getRealPath("uploadFiles/pictures");
C:\Program Files (x86)\apache-tomcat-7.0\uploadFiles\pictures

 

相关文章:

  • 2022-12-23
  • 2022-03-03
  • 2022-12-23
  • 2021-05-29
  • 2022-02-03
  • 2021-11-22
猜你喜欢
  • 2022-12-23
  • 2021-12-07
  • 2022-12-23
  • 2021-09-26
  • 2022-12-23
  • 2022-01-03
  • 2022-12-23
相关资源
相似解决方案