Gentle Breeze

IoC Sample 본문

⑦ IFSS 방법론/IFSS 기초(개발자)

IoC Sample

재령 2008. 10. 7. 13:19

* User.java

package com.sds.emp.sample;

public class User {
     private String userid;

     public String getUserid() {
          return userid;
     }

     public void setUserid(String userid) {
          System.out.println("setUserid called..." + userid);
          this.userid = userid;
     }
}

===========================================================================================

* input.html

<!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>
<form action="./output.jsp">
     id<input type="text" name="userid"/>
       <input type="submit" value="전송"/>
</form>
</body>
</html>

===========================================================================================

* output.jsp

<%@ 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="user" class="com.sds.emp.sample.User"> //class에 해당하는 Bean 객체를 생성,
                                                                                           //id는 참조변수
         <jsp:setProperty name="user" property="userid"/> //userid 라는 property 값을 set
    </jsp:useBean>
</body>
</html>

'⑦ IFSS 방법론 > IFSS 기초(개발자)' 카테고리의 다른 글

Beans  (0) 2008.10.07
Spring IoC Container <2>  (0) 2008.10.07
Spring IoC Container <1>  (0) 2008.10.07
Core Framework  (0) 2008.10.07
AnyFrame Java 개요  (0) 2008.10.07
Comments