摘要: 从Request对象中可以获取各种路径信息,以下例子:假设请求的页面是index.jsp,项目是WebDemo,则在index.jsp中获取有关request对象的各种路径信息如下String path = request.getContextPath();String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";String remoteAddress=request.getRemo 阅读全文
posted @ 2013-11-14 13:41 小码农_ZXB 阅读(293) 评论(0) 推荐(0) 编辑
摘要: 一般使用Struts2的拦截器(或者是filter)验证是否登录的时候,如果用户没有登录则会跳转到登录的页面。这时候一般可以在拦截器或者filter中用response.sendRedirect()。 但当在页面上使用了iframe后,发现跳转的只是页面中iframe内的区域,而父页面却没有跳转。拦截器或者过滤器中发送重定向请求时,是在iframe页面发送的。原来的代码是这样的: public String intercept(ActionInvocation invocation) throws Exception { /* If the user have not b... 阅读全文
posted @ 2013-11-14 13:16 小码农_ZXB 阅读(2321) 评论(0) 推荐(0) 编辑