您的位置:首页 > 运维架构 > Tomcat

servlet中获得tomcat项目根目录的绝对路径

2014-04-22 14:53 465 查看
public class CreateXmlAction extends HttpServlet {

private ServletConfig config;
public void init(ServletConfig config) throws ServletException {
this.config = config;
}

public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
String  filePath = config.getServletContext().getRealPath("/");
}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: