1
2
3
                                                              <!-- required반드시써야함 -->
<tr> <td>ID</td> <td><input type="text" placeholder="id를 입력하세요" required="required"> </td></tr> 
<tr> <td> 비밀번호 </td> <td><input type="password" name="pwd" id="pwd" required> </td></tr>
cs

(html파일)

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
<!DOCTYPE html>
<html>
<head>
<meta charset="EUC-KR">
<title>ex17_inputType2</title>
</head>
<body>    
    <!-- .jsp파일로 넘김 -->
    <form action="ex17_test.jsp" method="post" autocomplete="off">
    
    <fieldset>
    <!-- 줄로감싸서 구분가능 -->
        <label for="fnameid"> Name(여기를눌러도됨): </label> 
        <!-- label for="실행을원하는 input의 id명" => label안의 글자를 눌러도 해당 input이 실행 -->
            First Name : <input type="text" name="fname" autocomplete="off" id="fnameid"><br />
            Last Name : <input type="text" name="lname" autofocus="autofocus" 
                        pattern="[A-Za-z]{3}" title="세글자만 포함하세요." required="required"><br />
    </fieldset>
    
    <fieldset>
        <label for="emailid"> email(여기를눌러도됨):</label>
            Email : <input type="email" name="email" autocomplete="off" id="emailid"><br />
    </fieldset>
    
        <input type="submit" value="send">        
    </form>
</body>
</html>
cs

(jsp파일)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<%@ 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>
 
    <%
        String fname=request.getParameter("fname");
        String lname=request.getParameter("lname");
        String email=request.getParameter("email");
        
        out.print("이름은 " + lname+fname + "<br>");
        out.print("메일주소는 " + email);
    %>
 
</body>
</html>
cs

http://localhost:8080/day33_html/1/ex17_inputType2.html


 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<!DOCTYPE html>
<html>
<head>
<meta charset="EUC-KR">
<title>ex17_inputType</title>
</head>
<body>
    <form action="" method="post" autocomplete="off">
        First Name : <input type="text" name="fname" autocomplete="off"><br />
        Last Name : <input type="text" name="lname" autofocus="autofocus" 
                    pattern="[A-Za-z]{3}" title="세글자만 포함하세요." required="required"><br />
                    <!-- 대소문자합해서 3글자만써야함 -->
        
        Email : <input type="email" name="email" autocomplete="off"><br />
        <input type="submit" value="send">        
    </form>
</body>
</html>
cs

 

http://localhost:8080/day33_html/1/ex17_inputType.html

 

1
2
<!-- 주석적용: ctrl + shift + /  -->
<!-- 주석 풀기: ctrl + shift + \ -->
cs

 

+ Recent posts