JSP

211012_form전송(checkbox)

요옫 2021. 10. 12. 15:13

html

<!DOCTYPE html>

<html>

<head>

<meta charset="UTF-8">

<title>Insert title here</title>

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css">

<script src="https://code.jquery.com/jquery-3.5.0.js"></script>

<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script>

</head>

<body>

<h2>여러 데이터 전송하기</h2>

<form action="ex11_formdatas_action.jsp" method="post">

  <table class="table table-hover">

    <tr>

      <th width="100">이름</th>

      <td>

        <input type="text" name="name" size="5" placeholder="이름">

      </td>

    </tr>

    

    <tr>

      <th width="100">비밀번호</th>

      <td>

        <input type="password" name="pass" size="5" placeholder="비밀번호">

      </td>

    </tr>

    

    <tr>

      <th width="100">운전면허</th>

      <td>

        <input type="checkbox" name="license">취득

      </td>

    </tr>

    

    <tr>

      <td colspan="2" align="center">

        <input type="submit" value="전송">

        <input type="reset" value="초기화">

      </td>

    </tr>

  </table>

</form>

 

</body>

</html>

 

 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

 

 

 

formdatas_action.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>

<link href="https://fonts.googleapis.com/css2?family=Nanum+Pen+Script&display=swap" rel="stylesheet">

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css">

<script src="https://code.jquery.com/jquery-3.5.0.js"></script>

<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script>

</head>

<body>

<%

request.setCharacterEncoding("utf-8");

String name=request.getParameter("name");

String pass=request.getParameter("pass");

String license=request.getParameter("license");

%>

 

<h3>ex11 결과값 출력</h3>

이름: <%=name %><br>

비밀번호: <%=pass %><br>

운전면허: <%=license==null?"미보유":"보유" %>

</body>

</html>

 

 

'JSP' 카테고리의 다른 글

211019_복습(jsp)  (0) 2021.10.19
211019_jsp로 게시판 만들기  (0) 2021.10.19
211012_form전송(checkbox, radio,select,array)  (0) 2021.10.12
211012_form전송(back)  (0) 2021.10.12
211012_form전송(post,get)  (0) 2021.10.12