HTML5

form.html

 

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
<!-- 
form : 입력 양식
action : 받은 주소 
method : 전송 방식 (get, post), 기본값은 get
	get(자료 요청)
	post(자료 제출)
<input>입력상자 type="데이터의 종류" type을 생략하면 text	
    name=변수명
HTTP STatus 404- Not Found 웹페이지의 주소가 틀릴 경우
   
정적인 컨텐츠 - html
동적인 컨텐츠 - jsp , javascript
웹프로그래밍 언어 : cgi, php, asp, jsp, asp.net(c# or vb)
비연결성
form - 문자열만 전송 가능
request.setAttribute() 모든 자료형 전송 기능
-->

<form action="search.jsp" method="post">
텍스트 입력 상자
	<input type="text" name="search">
	<input type="submit" value="검색"> <!-- 제출버튼 -->
</form>




</body>
</html>






 

텍스트 입력 상자  

 

 

search.jsp

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html >
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>

<%
// 	request 내장객체 : 클라이언트의 요청을 처리
//	request.getParameter("변수명") 태그에 입력된 값 조회
//인코딩 설정
request.setCharacterEncoding("utf-8");
String search=request.getParameter("search"); 
%>

입력한 값 : <%= search %> <!-- = 값 , 출력문 -->



</body>
</html>




 

입력한 값 : ff

 

 

label.html

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
<!-- 
html - 태그(컨텐츠
css - 디자인 요소
< 태그 style="스타일속성 : 스타일값" > 태그의 스타일 변경
list-style:none 불릿을 표시하지 않음

id속성 - 중복 안됨
name속성 - 중복가능(라디오버튼, 체크박스) jsp 에서 참조
 

 -->
<form action="login.jsp" method="post">
<ul><!--  순서없는 리스트 Unordered List -->
	<li> <!-- List Item -->
		<label for="id">아이디</label> <!--  입력상자에 대한 라벨 -->
		<input id="id" name="id"> <!-- type생략 => -->
	</li>
	
	<li>
	 <label for="pw">비밀번호</label>
	 <input type="password" id="pw" name="pw"><!--  비밀번호 입력상자 -->
	</li>
	
	<li>
		<input type="submit" value="로그인" ><!--  제출 버튼 -->
	</li>
			
</ul>
</form>


</body>
</html>









 

  • 아이디 
  • 비밀번호 

 

 

 

login.jsp

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html >
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>

<%
//태그에 입력한 값을 조회
String id=request.getParameter("id");
String pw=request.getParameter("pw");

%>

아이디 : <%= id %> <br>
비번 :<%= pw %>


</body>
</html>

 

아이디 : braverokmc
비번 :1111111

 

 

 

 

 

 

 

 

 

 

 

about author

PHRASE

Level 60  머나먼나라

내리사랑은 있어도 치사랑은 없다 , 부모가 자식을 사랑하는 만큼 자식이 부모를 사랑하기는 어렵다는 말.

댓글 ( 4)

댓글 남기기

작성