Request ³»ºÎ °´Ã¼´Â Server¿¡¼­ Client ( ´ëºÎºÐÀº Browser ) ¿¡ º¸³»´Â Á¤º¸¸¦ Control ÇÏ´Â °´Ã¼ÀÔ´Ï´Ù.

javax.servlet.ServletRequest¸¦ º¸´Ï ¸¹Àº Method ¸¦ Áö¿øÇÏ°í ÀÖ½À´Ï´Ù. ÀÌ¿¡ ´ëÇÑ °ÍÀº javadoc ¹®¼­¸¦ º¸½Ã¸é µÉ °Í °°½À´Ï´Ù.

 

¿©±â¼­´Â ȯ°æº¯¼ö, ¸Å°³º¯¼ö, ÄíÅ° °ªÀ» ¿¢¼¼½º ÇÏ´Â ¿¹¸¸ ¼Ò°³ÇÏ°Ú½À´Ï´Ù.

 

ȯ°æº¯¼ö

<%@ page contentType="text/html;charset=euc-kr" %>

<html>

<body>

<font face=Arial>

<b><u>Implicit Object - Request</u></b><br>

<%

out.println("Method : " + request.getMethod()+"<br>");           

out.println("QueryString : " + request.getQueryString()+"<br>");          

out.println("RemoteAddr : " + request.getRemoteAddr()+"<br>");         

out.println("RequestURI : " + request.getRequestURI()+"<br>");          

out.println("ServletPath : " + request.getServletPath()+"<br>");            

out.println("ContentType : " + request.getContentType()+"<br>");        

out.println("ContentLength : " + request.getContentLength()+"<br>");  

out.println("CharacterEncoding : " + request.getCharacterEncoding()+"<br>");

%>

</font>

</body>

</html>

 

 

¸Å°³º¯¼ö

<%@ page contentType="text/html;charset=euc-kr" %>

<html>

<body>

<font face=Arial>

<b><u>Implicit Object - Request</u></b><br>

<form method=POST action="im2.jsp">

ID : <br>

<input type=text size=20 name=ID value=""><br>

Name : <br>

<input type=text size=20 name=NAME value=""><br>

Language :<br>

<input type=checkbox name=L value=JSP> JSP

<input type=checkbox name=L value=Perl> Perl

<input type=checkbox name=L value=PHP> PHP

<br>

<input type=submit value="È®ÀÎ">

</form>

<%

              for (java.util.Enumeration e = request.getParameterNames() ; e.hasMoreElements() ;) {

                            String name = e.nextElement().toString();

                            out.println(name + ":"+request.getParameter(name)+"<br>");

              }

 

             String lan[] = request.getParameterValues("L");

             for(int i = 0;i < lan.length;i++){

                           out.println(lan[i]+";");

             }

%>

</font>

</body>

</html>

 

 

 

 

ÄíÅ°

<%@ page contentType="text/html;charset=euc-kr" %>

<html>

<body>

<font face=Arial>

<b><u>Implicit Object - Request ( Cookie Setting )</u></b><br>

<%

Cookie c1 = new Cookie("ID","smson");

response.addCookie(c1);

Cookie c2 = new Cookie("NAME","¼Õ»ó¸ð");

response.addCookie(c2);

 

Cookie[] cookies = request.getCookies();

 for( int i = 0; i < cookies.length; i++ ){

             Cookie thisCookie =  cookies[i];

             out.println(thisCookie.getName() + " => " );

             out.println(thisCookie.getValue() + "<br>" );

}

 

%>

</font>

</body>

</html>

 

Reference Site

- http://www.jspschool.com

Reference Book

- Web Development with Java Server Pages. by Duane K. Fields & Mark A. Kolb ,°û¿ëÀçÆí¿ª ; InfoBook, Manning