您的位置:首页 > 产品设计 > UI/UE

request.getContextPath. getServletPath

2016-05-18 17:46 459 查看
String uri = req.getRequestURI(); ///miweb/fplan/index.do StringBuffer url = req.getRequestURL(); //http://localhost:8080/miweb/fplan/index.do String cPath = req.getContextPath(); ///miweb String servletPath =req.getServletPath(); ///fplan

String uri = req.getRequestURI(); //"/miweb/fplan/index.do"

StringBuffer url = req.getRequestURL(); //"http://localhost:8080/miweb/fplan/index.do"

String cPath = req.getContextPath(); //"/miweb"

String servletPath =req.getServletPath(); //"/fplan/index.do"

String realPath1 = req.getRealPath("/"); //得到工程文件的实际物理路径,也就是绝对地址。不过已经不推荐使用

了。"E:/MoneyTrunk/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/miweb/"

String realPath2 = req.getSession().getServletContext().getRealPath("/"); //得到工程文件的实际物理路径,也就是绝对地
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: