Notice
Recent Posts
Recent Comments
Link
«   2024/07   »
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 29 30 31
Tags
more
Archives
Today
Total
관리 메뉴

WON.dev

chapter03 : useBean1 / useBean2 본문

JSP/ACTION.BEAN

chapter03 : useBean1 / useBean2

GAWON 2023. 5. 23. 19:18
<%@ 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>
	<form action="Ex03_useBean2.jsp">
		<div>이름<input type="text" name="name"></div>
		<div>나이<input type="text" name="age"></div>
		<div>키<input type="text" name="height"></div>
		<div>주소<input type="text" name="addr"></div>
		<input type="submit" value="전송"><!-- input name이랑 VO의 변수명이랑 맞추면 자동으로 연결해줌 -->
	</form>
</body>
</html>
<%@ 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>
	<%--
		자바 빈 사용 방법
		1. 특정 패키지에 자바빈을 만든다.
		2. 자바빈을 생성한다.
		 	<jsp:useBean id="별명" class="패키기.자바클래스명" scope="생명주기"/>
		3.자바빈에 값을 저장한다
			<jsp:setProperty Property ="*" name="별명"/>
		4.자바빈의 값을 사용한다
			<jsp:getProperty Property ="파라미터명" name="별명"/>	   	
	--%>
	
	<jsp:useBean id="mb" class="org.joonzis.bean.PersonVO"/>
	<jsp:setProperty property="*" name="mb"/>
	
	<h1>
		이름 : <jsp:getProperty property="name" name="mb"/>
		나이 : <jsp:getProperty property="age" name="mb"/>
		키 : <jsp:getProperty property="height" name="mb"/>
		주소 : <jsp:getProperty property="addr" name="mb"/>
	</h1>

</body>
</html>

'JSP > ACTION.BEAN' 카테고리의 다른 글

chapter04 : useBean1 / useBean2  (0) 2023.05.23
chapter02 : DTO  (0) 2023.05.23
chapter01 : include 1 / include 2  (0) 2023.05.23
action.bean : PersonVO  (0) 2023.05.23
action.bean : MemberDTO.java  (0) 2023.05.23