본문 바로가기
JavaWeb

[JSP]useBean

by 캡틴노랑이 2015. 9. 7.
반응형

scope=객체의 유지할 범위를 설정
   pageContext(자신페이지)
   request(페이지간 이동)
   session(브라우저)
   application(톰켓)

<jsp:useBean id="obj" class="MyClasses.MyClass" scope="session">
  <jsp:setProperty name="obj" property="i" value="11"/>
</jsp:useBean>

<jsp:setProperty name="obj" property="*" />

<jsp:getProperty name="obj" property="i" />
<%=obj.getTel() %>

 

http://codeworld.tistory.com/entry/UseBean-%EC%82%AC%EC%9A%A9-%EB%B0%A9%EB%B2%95
http://okjsp.pe.kr/lecture/lec04/bean01.htm
http://blog.daum.net/oraclejava/15867606 

 

<%@ page language="java" contentType="text/html; charset=EUC-KR"
    pageEncoding="EUC-KR"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=EUC-KR">
<title>Insert title here</title>
</head>
<body>
 <jsp:useBean id="obj" class="test.Point">
  <jsp:setProperty name="obj" property="*" />
 </jsp:useBean>
 <br/>
 
 x:<jsp:getProperty name='obj' property="x" /><br/>
 y:<%= obj.getY() %><br/>
 distance:<jsp:getProperty name='obj' property="distance"/>
 
 
</body>
</html>

 

반응형

댓글