* text / textarea / checkbox / radio / select 등의 기능 추가
- ex08.jsp 파일
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 32 33 34 35 36 | <%@ page language="java" contentType="text/html; charset=EUC-KR" pageEncoding="EUC-KR"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=EUC-KR"> <title>Insert title here</title> </head> <body> <h1>회원가입</h1> <form action="ex09.jsp" method="post"> <!-- 파라미터 (post방식은 주소표시뒤 감춰준다)--> <p>id:<input type="text" name="id" ></p> <p>pw:<input type="password" name="pw"></p> <p>content:<textarea rows="5" cols="20" name="con"></textarea></p> <p>취미: <input type="checkbox" name="chk1" value="ck1">야구 <input type="checkbox" name="chk1" value="ck2">농구 <input type="checkbox" name="chk1" value="ck3">배구 </p> <p>지금수업: <input type="radio" name="lec" value="java">java <input type="radio" name="lec" value="web">web <input type="radio" name="lec" value="spring">spring </p> <p> <select name="sel"> <option value="sel1">select1</option> <option value="sel2">select2</option> <option value="sel3">select3</option> <option value="sel4">select4</option> </select> <p><input type="submit" value="전송"></p> </form> </body> </html> | cs |
- ex09.jsp 파일
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 32 33 34 35 36 37 38 39 40 | <%@page import="java.util.Enumeration"%> <%@ page import="java.util.Map" %> <%@ page language="java" contentType="text/html; charset=EUC-KR" pageEncoding="EUC-KR"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=EUC-KR"> <title>Insert title here</title> </head> <body> <h1>전달받은 내용</h1> <h2>id:<%=request.getParameter("id") %></h2> <h2>pw:<%=request.getParameter("pw") %></h2> <h2>content:<%=request.getParameter("con") %></h2> <h2>오늘수업:<%=request.getParameter("lec") %></h2> <h2>선택:<%=request.getParameter("sel") %></h2> <h2>취미:<% String[] sts = request.getParameterValues("chk1"); for(int i=0;i<sts.length;i++){ out.print(sts[i]+""); } ///////////////////////////////////////////////////////// //Map map = request.getParameterMap(); //String[] val1 = (String[])map.get("chk1"); //for(int i=0;i<val1.length;i++){ // System.out.println(val1[i]); //} ///////////////////////////////////////////////////////// //Enumeration em = request.getParameterNames(); //while(em.hasMoreElements()){ // String param = (String)em.nextElement(); // System.out.print(param+":"); // System.out.println(request.getParameter(param)); //} %></h2> </body> </html> | cs |
'* Programming > WEB' 카테고리의 다른 글
DB연동 데이터 입력 (0) | 2016.09.08 |
---|---|
Form(로그인창) (0) | 2016.09.08 |
기본 내장객체 (0) | 2016.09.08 |
스크립트릿 특징 (0) | 2016.09.08 |
Table사용(구구단 만들기) (1) | 2016.09.08 |