struts拦截器和url放行
程序员文章站
2024-02-01 13:15:04
...
假定你的web application 名称为CardHolderWeb,你在浏览器中输入请求路径:
http://localhost:8080/CardHolderWeb/memberCardManagement/init.action
则执行下面向行代码后打印出如下结果:
1、 System.out.println(request.getContextPath());
打印结果:/CardHolderWeb
2、System.out.println(request.getServletPath());
打印结果:/memberCardManagement/init.action
3、 System.out.println(request.getRequestURI());
打印结果:/CardHolderWeb/memberCardManagement/init.action
4、System.out.println(request.getRequestURL());
打印结果:http://localhost:8080/CardHolderWeb/memberCardManagement/init.action
5、 System.out.println(request.getRealPath("/"));
打印结果:发布到项目的目录
http://localhost:8080/CardHolderWeb/memberCardManagement/init.action
则执行下面向行代码后打印出如下结果:
1、 System.out.println(request.getContextPath());
打印结果:/CardHolderWeb
2、System.out.println(request.getServletPath());
打印结果:/memberCardManagement/init.action
3、 System.out.println(request.getRequestURI());
打印结果:/CardHolderWeb/memberCardManagement/init.action
4、System.out.println(request.getRequestURL());
打印结果:http://localhost:8080/CardHolderWeb/memberCardManagement/init.action
5、 System.out.println(request.getRealPath("/"));
打印结果:发布到项目的目录
上一篇: SpringMVC_3.x_入门指南_3
下一篇: 用epoll实现异步的Echo服务器