스트럿츠2 목록출력하기 : Struts2+iBATIS
반응형
Java Source
package com.xf.modules.code; /* '// codeACT '// programmed by Seok Kyun. Choi. (최석균) '// registered date 2009.03.27 '// updated date 2009.03.27 '// http://syaku.tistory.com */ import org.apache.log4j.Logger; import java.sql.SQLException; import java.util.List; import com.opensymphony.xwork2.ActionSupport; import com.ibatis.sqlmap.client.SqlMapClient; import com.xf.common.*; import com.xf.modules.code.codeDTO; public class codeACT extends ActionSupport { static Logger log = Logger.getLogger(codeACT.class); private static SqlMapClient conn = Conn.getInstance("com/xf/modules/code/codeSQL.xml"); private ListAr; public List getAr() { return Ar; } public String AdminCodeList() throws SQLException { // map statement call Ar = (List ) conn.queryForList("select-code",null); log.info("### result count : " + Ar.size()); return SUCCESS; } }
Example Source
<%@ page contentType="text/html; charset=UTF-8" %> <%@ taglib prefix="s" uri="/struts-tags" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html lang="ko" xml:lang="ko" xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <meta http-equiv="imagetoolbar" content="no" /> <title>Struts2 + iBatis</title> </head> <body> <div> <form name="list_form" action="?"> <table border="0" cellspacing="0"> <thead> <tr> <th scope="col">코드ID</th> <th scope="col">코드명</th> <th scope="col">코드설명</th> <th scope="col">생성일</th> <th scope="col">사용여부</th> </tr> </thead> <tbody> <s:iterator value="Ar"> <tr> <td><s:property value="code_id" /></td> <td><s:property value="code_title" /></td> <td><s:property value="code_comment" /></td> <td><s:date name="code_rdate" format="yyyy.MM.dd" /></td> <td><s:property value="code_use" /></td> </tr> </s:iterator> </tbody> </table> </form> </div> </body> </html>
written by Seok Kyun. Choi. 최석균.
http://www.cyworld.com/syaku
http://syaku.tistory.com
반응형
'개발노트 > Struts2' 카테고리의 다른 글
테스트용 코드관리 모듈 개발 #3 입력화면 : Struts2 + iBATIS is Sample (0) | 2009.04.08 |
---|---|
테스트용 코드관리 모듈 개발 #2 ActionMap : Struts2 + iBATIS is Sample (0) | 2009.04.08 |
테스트용 코드관리 모듈 개발 #1 SqlMap : Struts2 + iBATIS is Sample (0) | 2009.04.08 |
[Struts2+iBATIS]스트럿츠2 + iBatis 셋팅 (2) | 2009.04.07 |