1. 요청 ==> http://localhost:8282/abc/a.jsp?id=aa&pw=bb&addr=cc&tel=dd
결과화면==>
ID
: aa
PW : bb
ADDR : cc
TEL : dd
[an]
<%@ page contentType="text/html;charset=euc-kr" %>
ID:<%=request.getParameter("id")%><br>
PW:<%=request.getParameter("pw")%><br>
ADDR:<%=request.getParameter("addr")%><br>
TEL:<%=request.getParameter("tel")%><br>
====================================================================================================
2. b.jsp의 실행결과에서 '가입'을 누르면 아래와 같은
결과화면이 출력될 수 있도록 c.jsp를 작성하시오.
결과화면==>
ID : aa
PW : bb
ADDR : cc
TEL : dd
b.jsp
=====
<%@ page language="java" contentType="text/html;
charset=EUC-KR"
pageEncoding="EUC-KR"%>
<html>
<head>
<style
type="text/css">
td { border : 2px solid green;
}
</style>
</head>
<body>
<form
action="abc/c.jsp">
<table>
<tr><td>ID</td><td><input
type="text"></td></tr>
<tr><td>PW</td><td><input
type="text"></td></tr>
<tr><td>ADDR</td><td><input
type="text"></td></tr>
<tr><td>TEL</td><td><input
type="text"></td></tr>
<tr>
<td
colspan="2">
<input type="submit"
value="가입">
</td></tr>
</table>
</form>
</body>
</html>
[an]
b.jsp
-------
<%@ page language="java" contentType="text/html; charset=EUC-
KR"
pageEncoding="EUC-KR"%>
<html>
<head>
<style type="text/css">
td { border : 2px solid green; }
</style>
</head>
<body>
<form action="abc/c.jsp">
<table>
<tr><td>ID</td><td><input type="text" name="t1"></td></tr>
<tr><td>PW</td><td><input type="text" name="t2"></td></tr>
<tr><td>ADDR</td><td><input type="text" name="t3"></td></tr>
<tr><td>TEL</td><td><input type="text" name="t4"></td></tr>
<tr>
<td colspan="2">
<input type="submit" value="가입">
</td></tr>
</table>
</form>
</body>
</html>
c.jsp
---------
<%@ page contentType="text/html;charset=euc-kr" %>
ID:<%=request.getParameter("t1")%><br>
PW:<%=request.getParameter("t2")%><br>
ADDR:<%=request.getParameter("t3")%><br>
TEL:<%=reqauest.getParameter("t4")%><br>
====================================================================================================
3. d.jsp의 '전송'버튼을 눌렀을때의 url은 아래와 같다.
d.jsp와 e.jsp를 작성하시오.
http://localhost:8282/abc/e.jsp?pet=pig&pet=dog&pet=cat
당신이 좋아하는 애완동물 : pig dog cat
[an]
d.jsp
----------
<%@ page contentType="text/html;charset=euc-kr" %>
<form action="e.jsp">
<input type="checkbox" name="pet" value="pig">pig
<input type="checkbox" name="pet" value="cat">cat
<input type="checkbox" name="pet" value="dog">dog
<input type="submit">
</form>
e.jsp
---------
<%@ page contentType="text/html;charset=euc-kr" %>
<%
for(String s: request.getParameterValues("pet")){
out.println(s+"<br>");
}
%>
'jsp' 카테고리의 다른 글
DB연동 회원가입,삭제 (0) | 2013.10.31 |
---|---|
DB 연동 (0) | 2013.10.30 |
jsp와 db연동 (0) | 2013.10.28 |
선언문,request객체의메서드들,화면이동하기 (0) | 2013.10.23 |
JSP 첫시작~! 1일차 (0) | 2013.10.21 |