<%@ page
language="java"
contentType="text/html; charset=EUC-KR"
pageEncoding="EUC-KR"%>
<%@ page import="java.net.URLEncoder" %>
<%@page import="java.net.URLDecoder"%>
<html>
<body>

<font face=Arial>

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

<br>
<u>매개 변수</u>
<br>

<form method=POST action="?" >
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>

<%
try{
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++){
if( i < lan.length-1 ) out.println(lan[i]+";");
else out.println(lan[i]+"<br>");

}
}catch(Exception e){
out.println("아직 파라미터를 전송받지 못했습니다.");
}
%>

</font>


<br>
<hr>
<br>
<br>

<font face=Arial>

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

String Nom = URLEncoder.encode("홍완이");

Cookie c1 = new Cookie("ID","ngio");
Cookie c2 = new Cookie("NAME",Nom);
response.addCookie(c1);
response.addCookie(c2);

Cookie[] cookies = request.getCookies(); // 쿠키 배열에 쿠키값 가져오기

out.println( cookies.length + " 개의 쿠키가 존재합니다.<br><br>");

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

Cookie thisCookie = cookies[i];
out.println(thisCookie.getName() + " => " );
out.println(URLDecoder.decode(thisCookie.getValue(),"euc-kr") + "<br>" );
}


}catch(Exception e){

out.println("쿠키가 생성되지 않았습니다.");

}

%>

</font>

<br>
<hr>
<br>
<br>
<u>환경 변수</u>
<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>");

%>


</body>

</html>
크리에이티브 커먼즈 라이센스
Creative Commons License
이올린에 북마크하기

Posted by 홍반장

2009/10/07 15:38 2009/10/07 15:38
Response
No Trackback , No Comment
RSS :
http://tcbs17.cafe24.com/tc/rss/response/4694

Trackback URL : http://tcbs17.cafe24.com/tc/trackback/4694

« Previous : 1 : ... 1750 : 1751 : 1752 : 1753 : 1754 : 1755 : 1756 : 1757 : 1758 : ... 6391 : Next »

블로그 이미지

- 홍반장

Archives

Recent Trackbacks

Calendar

«   2024/12   »
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31        
Statistics Graph

Site Stats

Total hits:
250808
Today:
787
Yesterday:
295