form


form

문제

0419jsp_2
0419jsp_3

input 코드

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<% request.setCharacterEncoding("UTF-8"); %>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>2017305072 전은성</title>
</head>
<body>
Home>회원 정보 입력<br>
<hr>
<fieldset>
	<legend>개인 정보 입력</legend>
	<br>
	<form name="form1" method="post" action="Assign03_전은성_request1_result(2017305072).jsp">
이름 :<br>
<input type="text" name="name"><br><br>
비밀번호 :<br>
<input type="password" name="password"><br><br>
E-mail :<br>
<input type="text" name="email"><br><br>
연락처 : <br>
<select name="phone" size="1">
   <option value="tmp" selected="selected">선택</option>
   <option value="skt">SKT</option>
   <option value="kt">KT</option>
   <option value="lg">LG</option>
</select>
<input type="text" name="number1" maxlength="3" size="3">
-
<input type="text" name="number2" maxlength="4" size="4">
-
<input type="text" name="number3" maxlength="4" size="4"><br><br>
성별 : <input type="radio" value="남" name="sex"><input type="radio" value="여" name="sex"><br><br>
취미 : <input type="checkbox" value="운동" name="hobby">운동
<input type="checkbox" value="독서" name="hobby">독서
<input type="checkbox" value="여행" name="hobby">여행
<input type="checkbox" value="음악감상" name="hobby">음악감상<br><br>
본인 소개:
<textarea rows="10" cols="80" name="you"></textarea><br>
<hr>
<div align="center">
   <input type="submit" value="가입하기" name="join"> <input type="button" value="다시작성" name="redo">
</div>
</form>
</fieldset>
</body>
</html>

result 코드

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<% request.setCharacterEncoding("UTF-8"); %>
<%@page import = "java.util.Enumeration"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>정보확인</title>
</head>
<body>
Home>회원 정보 확인<br>
<hr>
이름 :<%=request.getParameter("name") %><br><br>
비밀번호 :<%=request.getParameter("password") %><br><br>
E-mail :<%=request.getParameter("email") %><br><br>
연락처 :<%=request.getParameter("phone") %>
 <%=request.getParameter("number1") %>-<%=request.getParameter("number2") %>-<%=request.getParameter("number3") %><br><br>
성별 :<%=request.getParameter("sex") %><br><br>
취미 : <%
   Enumeration enums = request.getParameterNames();

   while(enums.hasMoreElements()){
      String name = (String)enums.nextElement();      
      String values[] = request.getParameterValues(name);
     
      for(String value : values){
    	  if(name.startsWith("hobby")){
            out.println(value+"&nbsp");
         }else{
         }
      }      
   }
%>
<br><br>
본인 소개 : <%=request.getParameter("you") %>

</body>
</html>





© 2021.07. by 전은성

Powered by 전은성