getContextPath、getServletPath、getRequestURL、getRealPath的区别
来源:互联网 发布:python 在线教程 编辑:程序博客网 时间:2024/05/29 04:26
转自:http://veryls.iteye.com/blog/239830
假定你的web application 名称为news,你在浏览器中输入请求路径:
http://localhost:8080/news/main/list.jsp则执行下面向行代码后打印出如下结果:
1、 System.out.println(request.getContextPath()); //可返回站点的根路径。也就是项目的名字
打印结果:/news
2、System.out.println(request.getServletPath());
打印结果:/main/list.jsp
3、 System.out.println(request.getRequestURI());
打印结果:/news/main/list.jsp
4、 System.out.println(request.getRealPath("/"));
打印结果:F:\Tomcat 6.0\webapps\news\test
0 0
- getContextPath、getServletPath、getRequestURL、getRealPath的区别
- getContextPath、getServletPath、getRequestURI、getRealPath、getRequestURL、的区别
- getContextPath、getServletPath、getRequestURL、getRealPath的区别
- Request中getContextPath、getServletPath、getRequestURI、getRequestURL、getRealPath的区别
- Request中getContextPath、getServletPath、getRequestURI、getRequestURL、getRealPath的区别
- getRequestURL、getRequestURI、getContextPath、getServletPath和getRealPath的区别
- Request中getContextPath、getServletPath、getRequestURI、getRequestURL、getRealPath的区别
- Request中getContextPath、getServletPath、getRequestURI、getRequestURL、getRealPath的区别
- request.getContextPath().getRequestURI().getServletPath().getRequestURL().getRealPath() 图解
- getContextPath、getServletPath、getRequestURI、getRealPath的区别
- getContextPath、getServletPath、getRequestURI、getRealPath的区别
- getContextpath、getServletPath、getRealpath的不同
- Request中getContextPath、getServletPath、getRequestURI、request.getRealPath的区别
- Request中getContextPath、getServletPath、getRequestURI、request.getRealPath的区别
- Request中getContextPath、getServletPath、getRequestURI、request.getRealPath的区别
- Request中getContextPath、getServletPath、getRequestURI、request.getRealPath的区别
- Request中getContextPath、getServletPath、getRequestURI、request.getRealPath的区别
- Request中getContextPath、getServletPath、getRequestURI、request.getRealPath的区别
- 11478 - Halum(差分约束)
- 鸟哥的linux私房菜 阅读笔记一
- vim visual block模式
- ym——Android从零开始(32)(WebView)(新)
- ural 1002 Phone Numbers 字典树+dp
- getContextPath、getServletPath、getRequestURL、getRealPath的区别
- ios7、ios8中的UITableViewCellEditingStyle
- 连接错误,linker command failed with exit code 1
- spring应用hibernateTemplate的配置
- [ios]安全攻防之代码混淆的一个小工具
- C#Winform窗体如何最小化到系统托盘
- cocos3.x 编写C++控件在lua上面调用(一)
- unity中移动摄像机时物体闪烁模糊
- 039:hibernate:联合主键