标签:http java 使用 os io 数据 for ar
package request;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
//request请求转发,以及使用request域对象吧数据带给转发资源
public class RequestDemo5 extends HttpServlet {
//用congtext存数据是行不通的,但是request存数据是可以的,每个请求对象都有唯一的request
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String data = "aaaaaa";
request.setAttribute("data", data);
//request也可实现转发
request.getRequestDispatcher("/message.jsp").forward(request, response);
}
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
doGet(request, response);
}
}
标签:http java 使用 os io 数据 for ar
原文地址:http://www.cnblogs.com/siashan/p/3914737.html