为了避免与Servlet API耦合在一起,方便Action类做单元测试,Struts 2对HttpServletRequest、HttpSession和ServletContext进行了封装,构造了三个Map对象来替代这三种对象,在Action中,直接使用HttpServletRequest、Ht
分类:
其他好文 时间:
2016-02-24 12:23:16
阅读次数:
151
1.使用HttpServletRequest接收java代码/***测试HttpServletRequest接收参数***/@RequestMapping(value="/test")@ResponseBodypublicStringqueryAll(HttpServletRequestrequest){System.out.println(request.getParameter("date"));returnrequest.getParameter("date");}jsp代码..
分类:
编程语言 时间:
2016-02-22 19:24:44
阅读次数:
208
Cookie工具类,提供Cookie的创建、获取、删除方法。 源码如下:(点击下载 -CookieUtil.java ) 1 import javax.servlet.http.Cookie; 2 import javax.servlet.http.HttpServletRequest; 3 imp
分类:
编程语言 时间:
2016-02-19 14:01:40
阅读次数:
168
最近由于CAS相关的JAR包的重新封装,所以想尽量做到0配置,而这个过程中大量使 用HttpServletRequest,现在整理如下,以便以后查阅。(表格为从别的地方复制的,排版渣了点,酬和看吧。) 请求与响应相关的类和接口非常多,下表是主要的与请求和接口相关的类以及接口。 主要的与请求和接口相关
分类:
Web程序 时间:
2016-02-18 11:33:32
阅读次数:
148
spring的过滤器可以实现登录状态问题 1.创建一个AccessFilter类,基础代码 package com.ujia.util.access; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.Ht
分类:
编程语言 时间:
2016-02-17 11:02:37
阅读次数:
156
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String path = this.getServletCon
分类:
其他好文 时间:
2016-02-16 13:02:31
阅读次数:
190
别人的项目,刚用MyEclipse加载进来,一大堆错误(见怪不怪了) JSP报错,上图: 报错:“The method getContextPath() from the type HttpServletRequest refers to the missing type String” 解决方式:
分类:
其他好文 时间:
2016-02-15 12:12:04
阅读次数:
233
使用aop时需要request 和response 使用方法调用时 HttpServletRequest request = ((ServletRequestAttributes)RequestContextHolder.getRequestAttributes()).getRequest();一直
分类:
编程语言 时间:
2016-02-14 00:29:58
阅读次数:
298
1. Struts2架构图 当外部的httpservletrequest到来时 ,初始到了servlet容器(所以虽然Servlet和Action是解耦合的,但是Action依旧能够通过httpservletrequest取得请求参数), 然后通过Filter chain,Filter主要包括Act
分类:
其他好文 时间:
2016-02-05 11:58:01
阅读次数:
111
1 public String getIpAddr(HttpServletRequest request) { 2 String ip = request.getHeader("x-forwarded-for"); 3 if(ip == null || ip.length() == 0 || "un
分类:
编程语言 时间:
2016-02-05 11:46:34
阅读次数:
223