获取服务器上已部署项目的路径

时间:2011-07-11 07:53:51

标签: jsp servlets

我希望获得部署项目的远程地址或服务器地址。让我们假设

http://www.myname.com/ : host

deployedProj : deployed web App name

folderName : there is a folder inside the web App

i want to access this address : http://www.myname.com/deployedProj/folderName

1 个答案:

答案 0 :(得分:-1)

您可以使用requestDispatcher ...

做一件事
1.in servlet Action Class:  req.getRequestDispatcher("/your_WebApp_Name/folder_inside_project").forward(req,res);

e.g  req.getRequestDispatcher("/deployedProj/folderName").forward(req,res);

2. in JSP, 
 <%=request.getRequestURL()%>