<% String path = request.getContextPath();
//返回形式http://localhost:8080/upload
String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";/ >
2。 调用:
<%=basePath%>
在js代码里也可以直接用
request.getServletContext().getRealPath() +"/uploader"