HTML,CSS,JS,jQuery,AJAX/HTML+CSS

input + jsp / fieldset-줄로감싸기, label for="실행을원하는 input의 id명" => label안의 글자를 눌러도 해당 input이 실행

Y_____527 2021. 2. 24. 20:59

(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