我们经常需要从HttpServletRequest对象获取POST请求的数据,下面给出简练的代码共大家参考 StringBuffer jb = new StringBuffer(); String line = null; try { BufferedReader reader = req...
分类:
其他好文 时间:
2014-07-10 13:20:13
阅读次数:
920
ServletContext读取资源文件内容的方式有两种:
方法1.
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
InputStream in = this.getServletContext().g...
分类:
其他好文 时间:
2014-06-22 18:22:08
阅读次数:
208
1.
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
print3(response);
}
private void print(HttpServletResponse response) thr...
分类:
其他好文 时间:
2014-06-22 17:16:43
阅读次数:
175
用HttpServletRequest,现在整理如下,以便以后查阅。(表格为从别的地方复制的,排版渣了点,酬和看吧。)请求与响应相关的类和接口非常多,下表是主要的与请求和接口相关的类以及接口。主要的与请求和接口相关的类及接口 方法说明ServletInputStream Servlet的输入流...
分类:
其他好文 时间:
2014-06-18 09:19:50
阅读次数:
205
servlet:
public class UpAndDownServlet extends HttpServlet {
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setCon...
分类:
其他好文 时间:
2014-06-18 06:24:27
阅读次数:
205
struts.xml
${successResultValue}
${redirectResultValue}
BaseAction.java
package com.yl.action;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.H...
分类:
其他好文 时间:
2014-06-18 00:42:38
阅读次数:
225
/*** * 获取客户端IP * @param request * @return */
public static String getIpAddrByRequest(HttpServletRequest request) { String
ip...
分类:
其他好文 时间:
2014-06-11 11:11:05
阅读次数:
173
JSP中一共预先定义了9个这样的对象,分别为:request、response、session、application、out、
pagecontext、config、page、exception
1、request对象
request 对象是 javax.servlet.httpServletRequest类型的对象。 该对象代表了客户端的请求信
息,主要用于接受...
分类:
Web程序 时间:
2014-06-07 13:36:24
阅读次数:
161
首先定义我们自己的Interceptorpackage
com.web.interceptor;import javax.servlet.http.HttpServletRequest;import
org.apache.struts2.StrutsStatics;import org.apache...
分类:
其他好文 时间:
2014-05-29 03:49:22
阅读次数:
158
protected void doPost(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
response.setContentType(...
分类:
其他好文 时间:
2014-05-28 20:34:21
阅读次数:
305