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("/"); //得到工程文件的实际物理路径,也就是绝对地
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("/"); //得到工程文件的实际物理路径,也就是绝对地
相关文章推荐
- Problem D - Farey Sequence Length 2015 ACM/ICPC Greater New York Region
- EasyUI combogrid filter 在 FireFox chrome 下搜索中文的问题解决
- Android requestWindowFeature崩溃
- 【Arduino官方教程第一辑】示例程序 4-8 串口双向调用 (握手连接)
- 关于mysql的java.sql.SQLException: Incorrect string value: '\xF0\x9F\x91\xBD\xF0\x9F…'问题
- 115. Distinct Subsequences
- UGUI-初识
- iOS UIAlertController使用方法如何使用
- angular+ui-router+requirejs整合demo
- [解决方案]MySql提示:The server quit without updating PID file(…)失败
- UiAutomator——如何保存测试异常现场@Before @After
- iOS UITabBarController中设置字体颜色及大小
- MXE (M cross environment) Requirements
- Longest Increasing Subsequence
- 关于UIView布局的总结
- leetcode 232. Implement Queue using Stacks
- UIUITableView仿淘宝的两列式cell显示
- UE4之GamePlay
- iOS学习之—— UIDevice、NSBundle、NSLocale
- iOS 视图UIview属性介绍 以及视图层次方法