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