最新文章列表

获取项目部署路径

  Action类中代码:     ActionContext context = ActionContext.getContext();      HttpServletRequest request = (HttpServletRequest) context.get(ServletActionContext.HTTP_REQUEST);      String path=r ...
danandyu8013 评论(0) 有1117人浏览 2012-09-07 11:15

request 、response 跳转定向

尽管HttpServletResponse.sendRedirect方法和RequestDispatcher.forward方法都可以让浏览器获得另外一个URL所指向的资源,但两者的内部运行机制有着很大的区别。下面 ...
wangmored 评论(0) 有1445人浏览 2012-08-19 11:34

从request获取IP的方法

根据request获取IP的方式: public static String getIpAddr(HttpServletRequest request) {         String ip = request.getHeader("x-forwarded-for");         if(ip == null || ip.length() == 0 || "un ...
tanglizhi 评论(0) 有1585人浏览 2012-07-24 13:06

java反射 工具类

  import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.ArrayList; import java.util.List; import javax.servlet.http.HttpServletRequest; /**  * ...
晨必须的 评论(0) 有1065人浏览 2012-07-08 20:31

tomcat request.getParameter() 研究,api解读,以及解码解释

  Returns the value of a request parameter as a String, or null if the parameter does not exist. Request parameters are extra information sent with the request. For HTTP servlets, parameters are co ...
飞天奔月 评论(0) 有8608人浏览 2012-06-21 10:51

struts2中Httpsession、HttpServletRequest

另:struts的Map session 不是同一个Session struts里的Session实际上是一个Map集合, private Map<String, Object> session; 与servlet的HttpSession不同,struts2的session并不能在不同action里引用,放入session的值,只能在本action里取,以及传递到页面上。 stru ...
水兽登革热 评论(0) 有2193人浏览 2012-05-14 22:24

获取HttpServletRequest/HttpSession/ServletContext/HttpServletResponse对象

方法一、通过ServletActionContext类直接获取: public String rsa() throws Exception{ HttpServletRequest request = ServletActionContext.getRequest(); ServletContext servletContext = ServletActionContext.get ...
eric.cheng 评论(0) 有6642人浏览 2012-04-27 17:29

struts1源码中的单例模式

protected Action processActionCreate(HttpServletRequest request,                                          HttpServletResponse response,                                          ActionMapping mapping)   ...
柳月樱 评论(0) 有1167人浏览 2012-04-20 22:58

javaee-ServletRequest 类相关源代码解析

1.ServletRequest接口源代码     package javax.servlet; import java.io.BufferedReader; import java.io.IOException; import java.io.UnsupportedEncodingException; import java.util.Enumeration; import j ...
cfan_haifeng 评论(0) 有2020人浏览 2012-04-13 16:46

java file download

public HttpServletResponse download(String path, HttpServletResponse response) {         try {             // path是指欲下载的文件的路径。             File file = new File(path);             // 取得文件名。             ...
irisAndKevin 评论(0) 有928人浏览 2012-04-11 15:56

Servlet 学习 <1>

                        Servlet  入门 首先介绍一下Servlet入门级的一个小例子: 1,新建Web工程       建立Class 类 HelloWorldServlet,从HttpServlet 继承,重写doGet方法。 @Override protected void doGet(HttpServletRequest req, HttpServl ...
flystar007 评论(0) 有558人浏览 2012-02-07 09:58

ServletRequest和HttpServletRequest的联系与区别

HttpServletRequest和ServletRequest都是接口 HttpServletRequest继承自ServletRequest HttpServletRequest比ServletRequest多了一些针对于Http协议的方法。如getHeader (String name), getMethod () ,getSession () 等等。 他们 ...
whoosh 评论(0) 有7879人浏览 2011-12-12 21:19

Struts2获取request三种方法

Struts2获取request三种方法 struts2里面有三种方法可以获取request,最好使用ServletRequestAware接口通过IOC机制注入Request对象。 在Action中获取request方法一:   在Action中的代码: Map request = (Map)ActionContext.getContext().get("request&q ...
bluenemo 评论(0) 有5883人浏览 2011-11-23 15:16

取得用户IP地址

public static String getIpAddress(HttpServletRequest request) { String ip = request.getHeader("X-Forwarded-For"); if (StringUtils.isBlank(ip) || StringUtils.equalsIgnoreCase(ip, "u ...
fancyboy2050 评论(0) 有1270人浏览 2011-11-17 12:45

weblogic war 路径 getServletContext().getRealPath() 和request.getRealPath

weblogic获取路径总是为NULL 通常情况下载tomcat中 我们以前使用 HttpServletRequest request; request.getRealPath(arg0); 但是这是个过时的方法 request.getSession().getServletContext().getRealPath() 得到站点的绝对地址 HttpServletRequest request ...
尙善若水 评论(0) 有6535人浏览 2011-10-24 15:06

HttpServletRequestWrapper 学习

使用过滤器不能改变HttpServletRequest对象的参数确实大大缩减了filter的应用范围,幸运的是,可以通过使用装饰模式来改变其状态 下面就是一个HttpServletRequest装饰类的样例: 一个删除空白字符的Filter 通过实现一个删除空白字符的filter,来演示如何使用javax.servlet.http.HttpServletRequestWrapper类来装饰Http ...
dfwang 评论(0) 有1538人浏览 2011-10-20 09:17

最近博客热门TAG

Java(141744) C(73651) C++(68608) SQL(64571) C#(59609) XML(59133) HTML(59043) JavaScript(54919) .net(54785) Web(54514) 工作(54118) Linux(50905) Oracle(49875) 应用服务器(43289) Spring(40812) 编程(39454) Windows(39381) JSP(37542) MySQL(37267) 数据结构(36424)

博客人气排行榜

    博客电子书下载排行

      >>浏览更多下载

      相关资讯

      相关讨论

      Global site tag (gtag.js) - Google Analytics