728x90
반응형
13_05_form.jsp
13_05_form_process.jsp
13_05_form.jsp <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Insert title here</title> </head> <body> <h3>회원가입</h3> <form action="13_05_form_process.jsp" name="member" method="post"> <p> 아이디 : <input type="text" name="id"> <input type="button" value="아이디 중복검사"> </p> <p> 비밀번호 : <input type="password" name="passwd"></p> <p> 이름 : <input type="text" name="name"></p> <p> 연락처 : <input type="text" name="phone1" value="010" size="4" readonly> -<input type="text" name="phone2" maxlength="4" size="4"> <!-- -<input type="number" name="phone2" max="4" min="3"> --> -<input type="text" name="phone3" maxlength="4" size="4"> </p> <p>성별: <input type="radio" name="gender" value="남성" checked>남성 <input type="radio" name="gender" value="여성">여성 </p> <p>취미: <input type="checkbox" name="hobby" value="독서" checked>독서 <input type="checkbox" name="hobby" value="운동">운동 <input type="checkbox" name="hobby" value="영화">영화 </p> <p><textarea name="comment" cols="30" rows="3" placeholder="가입인사를 입력해주세요"></textarea> </p> <p> <input type="submit" value="가입하기"> <input type="reset" value="다시쓰기"> </p> </form> </body> </html>
13_05_form_process.jsp <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@ page import="java.io.*, java.util.*" %> <%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>08_05_02_form04_process.jsp</title> </head> <body> <% request.setCharacterEncoding("utf-8"); String id = request.getParameter("id"); String passwd = request.getParameter("passwd"); String name = request.getParameter("name"); String phone1 = request.getParameter("phone1"); String phone2 = request.getParameter("phone2"); String phone3 = request.getParameter("phone3"); String gender = request.getParameter("gender"); String[] hobby = request.getParameterValues("hobby"); String comment = request.getParameter("comment"); %> <p>아이디 : <%=id %></p> <p>비밀번호 : <%=passwd %></p> <p>이름 : <%=name %></p> <p>연락처 : <%=phone1 %>-<%=phone2 %>-<%=phone3 %></p> <p>성별 : <%=gender %></p> <p>취미 : <% if (hobby != null) { for (int i = 0; i < hobby.length; i++) { out.println(" "+hobby[i]); } }else{ out.print("선택한 취미가 없습니다."); } %> </p> <p>가입 인사 : <%=comment %></p> <% pageContext.setAttribute("LF","\n"); %> <%-- <% pageContext.setAttribute("comment",comment); %> --%> <c:set var="com" value="<%=comment %>"/> <p><textarea name="comment" cols="30" rows="3" placeholder="가입인사를 입력해주세요"><%=comment %></textarea> <p><c:out excapeXml="false" value="${fn:replace(com,LF,'<br>')}"></c:out></p> </body> </html>
728x90
반응형
'[JAVA]' 카테고리의 다른 글
[JSP] session - getAttributeNames, getAttribute / cookies (0) | 2024.03.19 |
---|---|
[JSTL] EL을 활용한 파라미터, 매서드 호출 (0) | 2024.03.19 |
[JSP] jstl = date, time, both (0) | 2024.03.19 |
[JSP] JSTML fmt (0) | 2024.03.19 |
[JSP] <response.sendRedirect / sendError /setIntHeader > (0) | 2024.03.14 |