「JSP入門」request、response、session、application、outの使い方

1.オブジェクト
String s = request.getParameter(“xxx");
request.setAttribute(“key","value");
request.getAttribute(“key");

2.responseオブジェクト
response.sendRedirect(“url");
response.getWriter().append(“xxx");

3.sessionオブジェクト
HttpSession session=request.getSession();
session.setAttribute(“key","value");
session.getAttribute(“key");

4.applicationオブジェクト
setAttribute(String key,Object obj);
getAttribute(String key);

5.outオブジェクト
out.print();
out.newLine();
out.close();

6.cookieオブジェクト

Cookie c = new Cookie(“key","value");
response.addCookie(c);
Cookie[] cc = request.getCookies();
for(Cookie c:cc){
}

Java

Posted by arkgame