슬라이드 1

Similar documents
슬라이드 1

I T C o t e n s P r o v i d e r h t t p : / / w w w. h a n b i t b o o k. c o. k r

<property name="configlocation" value="classpath:/egovframework/sqlmap/example/sql-map-config.xml"/> <property name="datasource" ref="datasource2"/> *

Web Service Computing

Spring Boot/JDBC JdbcTemplate/CRUD 예제

표준프레임워크로 구성된 컨텐츠를 솔루션에 적용하는 것에 문제가 없는지 확인

<4D F736F F F696E74202D20C1A632C8B8C7D1B1B9BDBAC7C1B8B5BBE7BFEBC0DAB8F0C0D32D496E E D56432E BC8A3C8AF20B8F0B5E55D>

Eclipse 와 Firefox 를이용한 Javascript 개발 발표자 : 문경대 11 년 10 월 26 일수요일

혼자서일을다하는 JSP. 이젠일을 Servlet 과나눠서한다. JSP와서블릿의표현적인차이 - JSP는 <html> 내에서자바를사용할수있는수단을제공한다. - 서블릿은자바내에서 <html> 을작성할수있는수단을제공한다. - JSP나서블릿으로만웹페이지를작성하면자바와다양한코드가

구축환경 OS : Windows 7 그외 OS 의경우교재 p26-40 참조 Windows 의다른버전은조금다르게나타날수있음 Browser : Google Chrome 다른브라우저를사용해도별차이없으나추후수업의모든과정은크롬사용 한

슬라이드 1

untitled

PowerPoint Template

슬라이드 1

Ext JS À¥¾ÖÇø®ÄÉÀ̼ǰ³¹ß-³¹Àå.PDF

(jpetstore \277\271\301\246\267\316 \273\354\306\354\272\270\264\302 Spring MVC\277\315 iBatis \277\254\265\277 - Confluence)

다른 JSP 페이지호출 forward() 메서드 - 하나의 JSP 페이지실행이끝나고다른 JSP 페이지를호출할때사용한다. 예 ) <% RequestDispatcher dispatcher = request.getrequestdispatcher(" 실행할페이지.jsp");

슬라이드 1

Javascript.pages

DocsPin_Korean.pages

untitled

untitled

8 장데이터베이스 8.1 기본개념 - 데이터베이스 : 데이터를조직적으로구조화한집합 (cf. 엑셀파일 ) - 테이블 : 데이터의기록형식 (cf. 엑셀시트의첫줄 ) - 필드 : 같은종류의데이터 (cf. 엑셀시트의각칸 ) - 레코드 : 데이터내용 (cf. 엑셀시트의한줄 )

Connection 8 22 UniSQLConnection / / 9 3 UniSQL OID SET

@OneToOne(cascade = = "addr_id") private Addr addr; public Emp(String ename, Addr addr) { this.ename = ename; this.a


PowerPoint 프레젠테이션

Research & Technique Apache Tomcat RCE 취약점 (CVE ) 취약점개요 지난 4월 15일전세계적으로가장많이사용되는웹애플리케이션서버인 Apache Tomcat에서 RCE 취약점이공개되었다. CVE 취약점은 W

Microsoft PowerPoint - web-part03-ch19-node.js기본.pptx

TP_jsp7.PDF

Intro to Servlet, EJB, JSP, WS

<4D F736F F F696E74202D203130C0E52EBFA1B7AF20C3B3B8AE205BC8A3C8AF20B8F0B5E55D>

쉽게 풀어쓴 C 프로그래밊

2파트-07

ibmdw_rest_v1.0.ppt

untitled

신림프로그래머_클린코드.key

슬라이드 1

제8장 자바 GUI 프로그래밍 II

제이쿼리 (JQuery) 정의 자바스크립트함수를쉽게사용하기위해만든자바스크립트라이브러리. 웹페이지를즉석에서변경하는기능에특화된자바스크립트라이브러리. 사용법 $( 제이쿼리객체 ) 혹은 $( 엘리먼트 ) 참고 ) $() 이기호를제이쿼리래퍼라고한다. 즉, 제이쿼리를호출하는기호

Microsoft PowerPoint - 10Àå.ppt

KYO_SCCD.PDF

교육2 ? 그림

Spring Boot

요약 1

MasoJava4_Dongbin.PDF

Interstage5 SOAP서비스 설정 가이드

Mobile Service > IAP > Android SDK [ ] IAP SDK TOAST SDK. IAP SDK. Android Studio IDE Android SDK Version (API Level 10). Name Reference V

Microsoft Word - src.doc

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션

04장

var answer = confirm(" 확인이나취소를누르세요."); // 확인창은사용자의의사를묻는데사용합니다. if(answer == true){ document.write(" 확인을눌렀습니다."); else { document.write(" 취소를눌렀습니다.");

Microsoft PowerPoint - Smart CRM v4.0_TM 소개_ pptx

Week13

untitled

rmi_박준용_final.PDF

PHP & ASP

Spring Data JPA Many To Many 양방향 관계 예제

PowerPoint 프레젠테이션

Analytics > Log & Crash Search > Unity ios SDK [Deprecated] Log & Crash Unity ios SDK. TOAST SDK. Log & Crash Unity SDK Log & Crash Search. Log & Cras

PowerPoint 프레젠테이션

교육자료

Microsoft PowerPoint - 04-UDP Programming.ppt

쉽게 풀어쓴 C 프로그래밍

14-Servlet

1. Windows 설치 (Client 설치 ) 원하는위치에다운받은발송클라이언트압축파일을해제합니다. Step 2. /conf/config.xml 파일수정 conf 폴더에서 config.xml 파일을텍스트에디터를이용하여 Open 합니다. config.xml 파일에서, 아

Orcad Capture 9.x

Dialog Box 실행파일을 Web에 포함시키는 방법

07 자바의 다양한 클래스.key

[ 그림 8-1] XML 을이용한옵션메뉴설정방법 <menu> <item 항목ID" android:title=" 항목제목 "/> </menu> public boolean oncreateoptionsmenu(menu menu) { getme

SK Telecom Platform NATE

슬라이드 1

NoSQL

2장 변수와 프로시저 작성하기

3장

INDEX 들어가기 고민하기 HTML(TABLE/FORM) CSS JS

파워포인트 템플릿

어댑터뷰

Microsoft Word - ntasFrameBuilderInstallGuide2.5.doc

HTML5

API STORE 키발급및 API 사용가이드 Document Information 문서명 : API STORE 언어별 Client 사용가이드작성자 : 작성일 : 업무영역 : 버전 : 1 st Draft. 서브시스템 : 문서번호 : 단계 : Docum

윈도우시스템프로그래밍

JMF2_심빈구.PDF

- 목차 - - ios 개발환경및유의사항. - 플랫폼 ios Project. - Native Controller와플랫폼화면연동. - 플랫폼 Web(js)-Native 간데이터공유. - 플랫폼확장 WN Interface 함수개발. - Network Manager clas

10.ppt

Overall Process

Spring

쉽게 풀어쓴 C 프로그래밍

C H A P T E R 2

Modern Javascript

<C0CCBCBCBFB52DC1A4B4EBBFF82DBCAEBBE7B3EDB9AE2D D382E687770>

하둡을이용한파일분산시스템 보안관리체제구현

PowerPoint Presentation

chap 5: Trees

중간고사

JUNIT 실습및발표

iii. Design Tab 을 Click 하여 WindowBuilder 가자동으로생성한 GUI 프로그래밍환경을확인한다.

09-interface.key

1

Transcription:

[ 실습 ] 예제어플리케이션개발 1. 실습개요 2. 프로젝트환경구성 3. 기본환경설정 4. 예제어플리케이션개발 5. 참조 - 1 -

1. 실습개요 (1/4) 스프링기반의 EGOV 프레임워크를사용하여구현된예제어플리케이션구현을통하여모바일 UX Layer와 Business Layer의연계를살펴본다. 예제어플리케이션구현기능 정보알림이등록, 수정, 삭제, 조회 Presentation Layer Business Layer HandlerMapping Notification Controller Notification Service NotificationDAO Dispacher- Sevlet JstlView UrlBaseView Resolver DATABASE - 2 -

1. 실습개요 (2/4) 예제어플리케이션실행순서 사용자는 Web Page를통해서버에요청을보낸다. Spring Framework에의해처리되는모든요청은고유한 URL 매핑혹은확장자 (*.do) 를가지고있다. 모든 URL 매핑혹은확장자는 Servlet Container에의해서모든요청이 Spring Framework에서제공하는 DipatcherServlet으로넘어가게된다. DispatcherServlet은클라이언트의요청을전달받는 Servlet으로서, 컨트롤러나뷰와같은스프링의 MVC 구성요소를이용하여클라이언트에게서비스를제공한다. DispatcherServlet 의설정은웹어플리케이션의 /WEB-INF/web.xml 파일에추가한다. DispatcherServlet은컨트롤러객체의 handlerequest() 메서드를호출하여클라이언트의요청을처리한다. 컨트롤러의 handlerequest() 메서드는처리결과정보를담은 ModelAndView 객체를리턴한다. DistpatcherServlet은 ViewResolver로부터응답결과를생성할뷰개체를구한다. 뷰는클라이언트에전송할응답을생성한다. - 3 -

1. 실습개요 (3/4) 프로젝트구조 (1/2) maven Repository MYSQL 로컬 DB 실행소스 (controller, interface, Impl, DAO..) 리소스정보 (message, spring context xml, SQL xml..) Web context - 4 -

1. 실습개요 (4/4) 프로젝트구조 (2/2) class Class Model NotificationVO CommonVO - bhntfcintrvl: String ([]) = new String[0] - bhntfcintrvlstring: String = "" - enddatetime: String = "" - frstregisterid: String = "" - frstregisternm: String = "" - frstregisterpnttm: String = "" + lastupdusrid: String = "" - lastupdusrpnttm: String = "" - ntfccn: String = "" - ntfcdate: String = "" - ntfchh: String = "" - ntfcmm: String = "" - ntfcno: String = "" - ntfcsj: String = "" - ntfctime: String = "" - startdatetime: String = "" - uniqid: String = "" + getbhntfcintrvl() : String[] + getbhntfcintrvlstring() : String + getenddatetime() : String + getfrstregisterid() : String + getfrstregisternm() : String + getfrstregisterpnttm() : String + getlastupdusrid() : String + getlastupdusrpnttm() : String + getntfccn() : String + getntfcdate() : String + getntfchh() : String + getntfcmm() : String + getntfcno() : String + getntfcsj() : String + getntfctime() : String + getstartdatetime() : String + getuniqid() : String + setbhntfcintrvl(string[]) : void + setbhntfcintrvlstring(string) : void + setenddatetime(string) : void + setfrstregisterid(string) : void + setfrstregisternm(string) : void + setfrstregisterpnttm(string) : void + setlastupdusrid(string) : void + setlastupdusrpnttm(string) : void + setntfccn(string) : void + setntfcdate(string) : void + setntfchh(string) : void + setntfcmm(string) : void + setntfcno(string) : void + setntfcsj(string) : void + setntfctime(string) : void + setstartdatetime(string) : void + setuniqid(string) : void + tostring() : String - beanvalidator: DefaultBeanValidator ~ commonmessagesource: CommonMessageSource - logger: Logger = Logger.getLogge... # notificationservice: NotificationService # propertyservice: EgovPropertyService NotificationController + deletenotification(notificationvo, NotificationVO, SessionStatus) : String + getnotifications(notificationvo, ModelMap) : String + insertnotification(httpservletrequest, NotificationVO, NotificationVO, BindingResult, SessionStatus, ModelMap) : String + insertnotificationpage(notificationvo, ModelMap) : String + selectnotification(notificationvo, ModelMap) : String + selectnotificationlist(notificationvo, ModelMap) : String + updatenotificaitonpage(notificationvo, ModelMap) : String + updatenotification(notificationvo, NotificationVO, BindingResult, ModelMap) : String #notificationservice «interface» NotificationServ ice + checknotification(notificationvo) : boolean + deletenotifiction(notificationvo) : void + insertnotification(notificationvo) : void + selectnotification(notificationvo) : NotificationVO + selectnotificationdata() : List<NotificationVO> + selectnotificationlist(notificationvo) : Map<String, Object> + updatenotifiction(notificationvo) : void NotificationServ iceimpl - logger: Logger = Logger.getLogge... - notificationdao: NotificationDAO NotificationDAO AbstractServiceImpl + checknotification(notificationvo) : boolean + deletenotifiction(notificationvo) : void - getdatetimewithoutsec(calendar) : String + insertnotification(notificationvo) : void + selectnotification(notificationvo) : NotificationVO + selectnotificationdata() : List<NotificationVO> + selectnotificationlist(notificationvo) : Map<String, Object> + updatenotifiction(notificationvo) : void -notificationdao + deletenotification(notificationvo) : void + getnotificationdata(notificationvo) : List<NotificationVO> + insertnotification(notificationvo) : String + selectnotification(notificationvo) : NotificationVO + selectnotificationlist(notificationvo) : List<NotificationVO> + selectnotificationlistcnt(notificationvo) : int + updatenotification(notificationvo) : void SqlMapClientFactoryBean SqlMapClientDaoSupport org.springframework.orm.ibatis.support.sqlmapclientdaosupport Egov AbstractDAO + delete(string, Object) : int # EgovAbstractDAO() : void + insert(string, Object) : Object + list(string, Object) : List + listwithpaging(string, Object, int, int) : List + selectbypk(string, Object) : Object + setsupersqlmapclient(sqlmapclient) : void + update(string, Object) : int - 5 -

2. 프로젝트환경구성 (1/10) Eclipse character encoding 설정 workspace의 character encoding은 UTF-8로한다. windows > preference를선택한다. general 탭의 workspace 선택후 Text file encoding 을 Other : UTF-8 로설정한다. - 6 -

2. 프로젝트환경구성 (2/10) Tomcat 서버를설정한다. windows > preference 를선택한다. server탭의 Runtime Environments 선택후 Add버튼을사용하여 Apache Tomcat의각버전 (Tomcat 6.0 이상 ) 에맞는 Tomcat 위치를지정한다. (Tomcat 은사용자의로컬에설치되어있어야한다.) - 7 -

2. 프로젝트환경구성 (3/10) egovframework.guideprogram.mobile 프로젝트를 import 한다 (1/2). File>Import... 메뉴를선택한다. General>Maven Projects 를선택한다. - 8 -

2. 프로젝트환경구성 (4/10) egovframework.guideprogram.mobile 프로젝트를 import 한다 (2/2). [ 압축해제폴더 ]\egovframework.guideprogram.mobile 를선택한다. Finish 버튼을클릭한다. - 9 -

2. 프로젝트환경구성 (5/10) Maven Dependencies 를확인한다. Maven Dependencies 가생성되었음을확인한다. - 10 -

2. 프로젝트환경구성 (6/10) Maven install 을실행한다. install 이성공하면 BUILD SUCCESSFUL 을확인할수있다. BUILD SUCCESSFUL 을확인한다 - 11 -

2. 프로젝트환경구성 (7/10) DBMS(Mysql DB) 를실행한다. [ 압축해제폴더 ]\egovframework.guideprogram.mobile\db\mysql_5.5.10 \bin 폴더로이동한다. 명령프롬프트를실행한후, mysqld 파일을실행시킨다. 종료 : mysql_5.5.10/bin 폴더에 mysqladmin u root shutdown - 12 -

2. 프로젝트환경구성 (8/10) 어플리케이션을실행하여테스트한다. DBMS, Tomcat Server 를실행시킨후, Web Application 이제대로실행되는지확인한다. - 13 -

2. 프로젝트환경구성 (9/10) 브라우저로접속하여어플리케이션실행을확인한다. - 14 -

2. 프로젝트환경구성 (10/10) 프로젝트환경구성 Resource 환경구성 message spring context sqlmap(query) Webapp 환경구성 common css images config (Spring MVC config) jsp web.xml - 15 -

3. 기본환경설정 (1/7) 어플리케이션구현스텝 web.xml 설정 컨트롤러처리결과사용할뷰를결정할 ViewResolver 설정 DataSource 설정 DataAccess 설정 SQLMap 설정 SQLMapConfig 설정 - 16 -

3. 기본환경설정 (2/7) 사용자 Request 를처리하기위한 web.xml 및기본환경 context-*.xml 파일설정 사용자요청을받는서블릿인 DispatcherServlet 은컨트롤러와뷰를이용하여사용자에게응답처리를한다. DispatcherServlet 은 Web Application 의 /WEB-INF/web.xml 파일에다음과같이설정한다. <?xml version="1.0" encoding="utf-8"?> <web-app> <servlet> <servlet-name>action</servlet-name> <servlet-class> org.springframework.web.servlet.dispatcherservlet </servlet-class> <init-param> <param-name>contextconfiglocation </param-name> <param-value> /WEB-INF/config/egovframework/springmvc/dispatcher-servlet.xml </param-value> </init-param> </servlet> <servlet-mapping> <servlet-name>action</servlet-name> <url-pattern>*.do</url-pattern> </servlet-mapping> </web-app> - 17 -

3. 기본환경설정 (3/7) web.xml 설정 Presentation Layer와 Business Layer 연계를위한설정 web.xml에 context-param 요소로 contextconfiglocation 등록한다. Presentation Layer에존재하는 Bean 설정파일의위치를등록하여 Application Context로쉽게참조할수있도록한다. <?xml version="1.0" encoding="utf-8"?> <web-app> <context-param> <param-name>contextconfiglocation </param-name> <param-value> classpath*:egovframework/spring/context-*.xml </param-value> </context-param> </web-app> - 18 -

3. 기본환경설정 (4/7) 컨트롤러처리결과사용할뷰를결정할 ViewResolver 설정 (1/2) 컨트롤러가지정한뷰이름으로부터응답결과화면을생성하는 View 객체는 ViewResolver를통해서생성한다. BasicSampleService의 Exception ViewResolver는아래와같이 dispatcher-servlet.xml에설정한다. <?xml version="1.0" encoding="utf-8"?> <bean class="org.springframework.web.servlet.handler.simplemappingexceptionresolver"> <property name="defaulterrorview" value="cmmn/egoverror" /> <property name="exceptionmappings"> <props> <prop key="org.springframework.dao.dataaccessexception">cmm/dataaccessfailure </prop> <prop key="org.springframework.transaction.transactionexception">cmm/transactionfailure </prop> <prop key="egovframework.rte.fdl.cmmn.exception.egovbizexception">cmm/egovbizexception</prop> </props> </property> </bean> - 19 -

3. 기본환경설정 (5/7) 컨트롤러처리결과사용할뷰를결정할 ViewResolver 설정 (2/2) Basisc Sample Service 의 ViewResolver 는아래와같이 dispatcher-servlet.xml 에설정한다. <?xml version="1.0" encoding="utf-8"?> <bean class="org.springframework.web.servlet.view.urlbasedviewresolver" p:order="1" p:viewclass="org.springframework.web.servlet.view.jstlview" p:prefix="/web-inf/jsp/" p:suffix=".jsp" /> - 20 -

3. 기본환경설정 (6/7) DataSource 설정 Datasource 추가 위치 : resources/egovframework/spring/context-datasource.xml Mysql 의 driverclassname : net.sf.log4jdbc.driverspy Mysql 의 url : jdbc:mysql://localhost:3306/mobile Mysql 의 username: mobile Mysql 의 password : mobile01 <bean id="datasource" class="org.apache.commons.dbcp.basicdatasource" destroymethod="close"> <property name="driverclassname" value="net.sf.log4jdbc.driverspy"/> <property name="url" value="jdbc:mysql://localhost:3306/mobile"/> <property name="username" value="mobile"/> <property name="password" value="mobile01"/> </bean> - 21 -

3. 기본환경설정 (7/7) DataAccess 설정 ibatis 를사용하기위한 SqlMapConfig 위치설정 <bean id="sqlmapclient" class="jcf.dao.ibatis.sqlmap.refreshablesqlmapclientfactorybean"> <property name="configlocations"> <list> <value>classpath:/sqlmap/config/*.xml</value> </list> </property> <property name="datasource" ref="datasource" /> SqlMapConfig 설정 : SQL 위치지정 <property name="lobhandler" ref="lobhandler"/> <!-- Java 1.5 or higher and ibatis 2.3.2 or higher REQUIRED --> <property name="mappinglocations" value="classpath:/sqlmap/sql/**/*_mysql.xml" /> <property name="checkinterval" value="1000" /><!-- millsecond --> </bean> - 22 -

4. 예제어플리케이션개발 (1/43) 어플리케이션구현스텝 목록조회기능개발 상세조회기능개발 입력기능및 validation 기능개발 수정기능개발 삭제기능개발 - 23 -

4. 예제어플리케이션개발 (2/43) 목록조회 NotificationVO 작성 SQLMap 작성및 SQL 작성 DAO 작성 Impl 작성 Controller 작성 JSP 작성 - 24 -

4. 예제어플리케이션개발 (3/43) NotificationVO 작성 속성 속성 설명 타입 ntfcno 알림번호 String ntfcsj 알림제목 String ntfccn 알림내용 String ntfcdate 알림날자 String ntfctime 알림시간 String bhntfcintrvl 사전알림간격 String 패키지 : egovframework.template.guide.service private String ntfcno; public String getntfcno() { return ntfcno; public void setntfcno(string ntfcno) { this.ntfcno = ntfcno;... - 25 -

4. 예제어플리케이션개발 (4/43) SQLMap 작성 Alias 추가 resources/egovframework/sqlmap/sql/guide/notification_sql_mysql.xml 파일에설정 notificationvo : egov egovframework.template.guide.service.notificationvo 1. 공지사항조회결과를매핑되기위한필드정보객체 <sqlmap namespace="education"> <typealias alias="notificationvo" type="egovframework.template.guide.service.notificationvo"/> </sqlmap> <resultmap id="notificationlist" class="egovframework.template.guide.service.notificationvo"> <result property="ntfcno" column="ntfc_no" columnindex="1"/> <result property="ntfcsj" column="ntfc_sj" columnindex="2"/> <result property="ntfccn" column="ntfc_cn" columnindex="3"/> <result property="ntfctime" column="ntfc_time" columnindex="4"/> <result property="bhntfcintrvlstring" column="bh_ntfc_intrvl" columnindex="5"/> <result property="frstregisterpnttm" column="frst_register_pnttm" columnindex="6"/> </resultmap> - 26 -

4. 예제어플리케이션개발 (5/43) 목록조회 (1/8) SQL 작성 : resources/egovframework/sqlmap/sql/guide/notification_sql_mysql.xml 파일에설정 <select id="notificationdao.selectnotificationlist" parameterclass="notificationvo" resultmap="notificationlist" > <![CDATA[ SELECT a.ntfc_no, a.ntfc_sj, a.ntfc_cn, DATE_FORMAT(a.NTFC_TIME, '%Y-%m-%d %H:%i:%S') as NTFC_TIME, CONCAT(REPLACE(BH_NTFC_INTRVL,',',' 분,'), ' 분 ') as BH_NTFC_INTRVL, DATE_FORMAT(a.FRST_REGISTER_PNTTM, '%Y-%m-%d') as FRST_REGISTER_PNTTM FROM COMTNNTFCINFO a WHERE 1=1 ]]> <isequal prepend="and" property="searchcnd" comparevalue="0"> <![CDATA[a.NTFC_TIME LIKE CONCAT (#searchwrd#,'%') ]]> </isequal> <isequal prepend="and" property="searchcnd" comparevalue="1"> <![CDATA[a.NTFC_SJ LIKE CONCAT ('%', #searchwrd#,'%') ]]> </isequal> <isequal prepend="and" property="searchcnd" comparevalue="2"> <![CDATA[a.NTFC_CN LIKE CONCAT ('%', #searchwrd#,'%') ]]> </isequal> <![CDATA[ ORDER BY a.frst_register_pnttm DESC LIMIT #recordcountperpage# OFFSET #firstindex# ]]> </select> - 27 -

4. 예제어플리케이션개발 (6/43) 목록조회 (2/8) DAO 클래스작성 public List<NotificationVO> selectnotificationlist(notificationvo vo) throws Exception { return list("notificationdao.selectnotificationlist", vo); Impl 클래스작성 public Map<String, Object> selectnotificationlist(notificationvo searchvo) throws Exception { List<NotificationVO> result = notificationdao.selectnotificationlist(searchvo); int cnt = notificationdao.selectnotificationlistcnt(searchvo); Map<String, Object> map = new HashMap<String, Object>(); Controller 작성 map.put("resultlist", result); map.put("resultcnt", Integer.toString(cnt)); return map; - 28 -

4. 예제어플리케이션개발 (7/43) 목록조회 (3/8) Controller 작성 @RequestMapping("/guide/selectNotificationList.do") public String selectnotificationlist(@modelattribute("searchvo") NotificationVO notificationvo, ModelMap model) throws Exception { LoginVO user = UserHelper.getUserInfo(); notificationvo.setuniqid(user.getuniqid()); logger.debug("search : " + notificationvo.getsearchwrd()); notificationvo.setpageunit(propertyservice.getint("pageunit")); notificationvo.setpagesize(propertyservice.getint("pagesize")); PaginationInfo paginationinfo = new PaginationInfo(); paginationinfo.setcurrentpageno(notificationvo.getpageindex()); paginationinfo.setrecordcountperpage(notificationvo.getpageunit()); paginationinfo.setpagesize(notificationvo.getpagesize()); notificationvo.setfirstindex(paginationinfo.getfirstrecordindex()); notificationvo.setlastindex(paginationinfo.getlastrecordindex()); notificationvo.setrecordcountperpage(paginationinfo.getrecordcountperpage()); Map<String, Object> map = notificationservice.selectnotificationlist(notificationvo); int totcnt = Integer.parseInt((String)map.get("resultCnt")); paginationinfo.settotalrecordcount(totcnt); model.addattribute("resultlist", map.get("resultlist")); model.addattribute("resultcnt", map.get("resultcnt")); model.addattribute("paginationinfo", paginationinfo); Jsp 에서 items 로결과를받아온다. return "guide/notificationlist"; View(notificationList.jsp) - 29 -

4. 예제어플리케이션개발 (8/43) 목록조회 (4/8) JSP( 선언부 ) <!DOCTYPE html> <html> HTML5 선언부 <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <title> 정보알림이 </title> Viewport 설정 <link rel="stylesheet" href="/css/egovframework/mbl/cmm/jquery.mobile-1.0b1.min.css"/> <link rel="stylesheet" href="/css/egovframework/mbl/cmm/egovmobile.css" /> <script src="/js/egovframework/mbl/cmm/jquery-1.6.1.min.js"></script> <script type="text/javascript"> $( document ).bind( "mobileinit", function(){ $.mobile.page.prototype.options.degradeinputs.date = 'text'; ); </script> <script src="/js/egovframework/mbl/cmm/jquery.mobile-1.0b1.min.js"></script> <script src="/js/egovframework/mbl/cmm/egovmobile.js"></script> <script type="text/javascript" src="/js/egovframework/mbl/cmm/datepicker/jquery.mobile.datebox.js"></script> <script language="javascript" src="<c:url value='/js/guide/notification.js' />"></script> Library Import <script type="text/javascript"> function isvaliddate(str) { </script> </head> - 30 -

4. 예제어플리케이션개발 (9/43) 목록조회 (5/8) JSP(service 영역 javascript) <script type="text/javascript"> function fn_egov_insert_notification() { document.frm.action = "<c:url value='/guide/insertnotificationpage.do'/>"; document.frm.submit(); 알람등록페이지 function fn_egov_select_notification(pageno) { if (document.frm.searchcnd.value == '0' && document.frm.searchwrd.value!= '') { if (rawdatestring(document.frm.searchwrd)) { // no-op else { alert('<spring:message code="errors.date" arguments=" 알림일자 " />'); document.frm.searchwrd.focus(); return; 알람목록조회 document.frm.pageindex.value = pageno; document.frm.action = "<c:url value='/guide/selectnotificationlist.do'/>"; document.frm.submit(); function fn_egov_inqire_notification(ntfcno) { document.frm.ntfcno.value = ntfcno; document.frm.action = "<c:url value='/guide/selectnotification.do'/>"; document.frm.submit(); </script> 알람상세보기 - 31 -

4. 예제어플리케이션개발 (10/43) 목록조회 (6/8) JSP(page, header, content, footer) <!-- 알림이목록 start --> <div data-role="page" data-theme="b" id="pagelist"> 모바일 Page 선언부 <form name="frm" method="post" action="<c:url value='/guide/selectnotificationlist.do'/>"> <input type="hidden" name="ntfcno"> <input name="pageindex" type="hidden" value="<c:out value='${searchvo.pageindex'/>"/> <!-- header start --> <div data-role="header"> <h1> 정보알림이 </h1> <a href="javascript:fn_egov_insert_notification(); data-role="button" data-icon="plus" class="ui-btn-right"><spring:message code="button.create" /></a> </div> <!-- header end --> header <!-- content start --> <div data-role="content"> </div> <!-- content end --> content <!-- footer start --> <div data-role="footer" data-position="fixed"> <h1>egovframe</h1> </div> <!-- footer end --> footer </form> </div> <!-- 알림이목록 end --> - 32 -

4. 예제어플리케이션개발 (11/43) 목록조회 (7/8) JSP(content 상세 ) <!-- content start --> <div data-role="content"> <div data-role="fieldcontain"> <label for="searchcnd" class="select"> 검색구분 : </label> <select name="searchcnd" id="searchcnd" data-native-menu="false"> <option></option> Select <option value="0" <c:if test="${searchvo.searchcnd == '0'">selected="selected"</c:if> > 알림일자 </option> <option value="1" <c:if test="${searchvo.searchcnd == '1'">selected="selected"</c:if> > 제목 </option> <option value="2" <c:if test="${searchvo.searchcnd == '2'">selected="selected"</c:if> > 내용 </option> </select> </div> <div data-role="fieldcontain"> <label for="searchwrd">text :</label> <input type="text" id="searchwrd" name="searchwrd" value='<c:out value="${searchvo.searchwrd"/>' maxlength="35"> </div> <a href="javascript:fn_egov_select_notification('1'); data-role="button" data-rel="dialog" data-transition="slideup"> 조회 </a> <ul data-role="listview" data-inset="true"> <c:foreach var="result" items="${resultlist" varstatus="status"> <li> <a href="javascript:fn_egov_inqire_notification('<c:out value="${result.ntfcno"/>');"> <h3><c:out value="${result.ntfcsj"/></h3> <p><strong> 알람시간 : <c:out value="${result.ntfctime"/></strong></p> <p> 사전알람간격 : <c:out value="${result.bhntfcintrvlstring"/></p> <p class="ui-li-aside"><c:out value="${result.frstregisterpnttm"/></p> </a> </li> </c:foreach> </ul> <p><ui:pagination paginationinfo="${paginationinfo" type="image" jsfunction="fn_egov_select_notification" /></p> </div> <!-- content end --> component Input component List component Page Navi - 33 -

4. 예제어플리케이션개발 (12/43) 목록조회 (8/8) 결과 - 34 -

4. 예제어플리케이션개발 (13/43) 알림조회 SQLMap (ResultMap) 작성 DAO 작성 Impl 작성 Controller 작성 JS 작성 - 35 -

4. 예제어플리케이션개발 (14/43) 알림조회 (1/5) SQL 작성 <select id="notificationdao.getnotificationdata" parameterclass="notificationvo" resultmap="notificationlist" > <![CDATA[ SELECT a.ntfc_no, a.ntfc_sj, a.ntfc_cn, DATE_FORMAT(a.NTFC_TIME, '%Y-%m-%d %H:%i:%S') as NTFC_TIME, BH_NTFC_INTRVL as BH_NTFC_INTRVL, DATE_FORMAT(a.FRST_REGISTER_PNTTM, '%Y-%m-%d %H:%i:%S') as FRST_REGISTER_PNTTM FROM COMTNNTFCINFO a WHERE a.ntfc_time BETWEEN #startdatetime# AND #enddatetime# ]]> <![CDATA[ ORDER BY a.ntfc_time ASC ]]> </select> DAO 작성 public List<NotificationVO> getnotificationdata(notificationvo vo) throws Exception { return list("notificationdao.getnotificationdata", vo); - 36 -

4. 예제어플리케이션개발 (15/43) 알림조회 (2/5) Impl 작성 public List<NotificationVO> selectnotificationdata() throws Exception { List<NotificationVO> result = new ArrayList<NotificationVO>(); NotificationVO vo = new NotificationVO(); SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMddHHmmss"); SimpleDateFormat other = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Calendar start = Calendar.getInstance(); Calendar end = Calendar.getInstance(); start.add(calendar.hour, -1); end.add(calendar.hour, 1); vo.setstartdatetime(formatter.format(start.gettime())); vo.setenddatetime(formatter.format(end.gettime())); List<NotificationVO> target = notificationdao.getnotificationdata(vo); Calendar current = Calendar.getInstance(); for (int i = 0; i < target.size(); i++) { vo = target.get(i); String[] interval = ("0," + vo.getbhntfcintrvlstring()).split(","); for (int j = 0; j < interval.length; j++) { Calendar alarm = Calendar.getInstance(); alarm.settime(other.parse(vo.getntfctime())); alarm.add(calendar.minute, -1 * Integer.parseInt(interval[j])); if (getdatetimewithoutsec(current).equals(getdatetimewithoutsec(alarm))) { result.add(vo); break; return result; - 37 -

4. 예제어플리케이션개발 (16/43) 알림조회 (3/5) Controller 작성 @RequestMapping("/guide/getNotifications.do") public String getnotifications(@modelattribute("searchvo") NotificationVO notificationvo, ModelMap model) throws Exception { Boolean isauthenticated = UserHelper.isAuthenticated(); if (isauthenticated) { List<NotificationVO> list = notificationservice.selectnotificationdata(); model.addattribute("list", list); return "guide/notificationdata"; - 38 -

4. 예제어플리케이션개발 (17/43) 알림조회 (4/5) JSP(notification.js : service 영역 javascript) // 서버로 XML 데이터요청. function fcrequestdata() { cfxmlhttpstatus("get", "/guide/getnotifications.do", true, ""); Ajax 요청 // 메인처리 function cfhttpresult(xmlhttp) { var xml = xmlhttp.responsexml; //XML 파일데이터 var notificationlist = xml.getelementsbytagname("list"); // Parent Node var titlenode = xml.getelementsbytagname("title"); var contentsnode = xml.getelementsbytagname("contents"); var rowcnt = notificationlist.length; // 레코드건수 for (var i = 0; i < rowcnt; i++) { var title = titlenode[i].childnodes[0].nodevalue; var contents = contentsnode[i].childnodes[0].nodevalue; jalert( "<" + title + ">" + contents, ' 정보알리미 '); Xml Data Parsing // 자동호출등록하기 window.setinterval('fcrequestdata()', 55000); Timer 등록 - 39 -

4. 예제어플리케이션개발 (18/43) 알림조회 (5/5) 결과 - 40 -

4. 예제어플리케이션개발 (19/43) 상세조회 SQLMap (ResultMap) 작성 DAO 작성 Impl 작성 Controller 작성 JSP 작성 - 41 -

4. 예제어플리케이션개발 (20/43) 상세조회 (1/5) SQLMap 작성 <resultmap id="notificationdetail" class="egovframework.template.guide.service.notificationvo"> <result property="ntfcno" column="ntfc_no" columnindex="1"/> <result property="ntfcsj" column="ntfc_sj" columnindex="2"/> <result property="ntfccn" column="ntfc_cn" columnindex="3"/> <result property="ntfctime" column="ntfc_time" columnindex="4"/> <result property="bhntfcintrvlstring" column="bh_ntfc_intrvl" columnindex="5"/> <result property="frstregisterid" column="frst_register_id" columnindex="6"/> SQL <result 작성 property="frstregisternm" column="frst_register_nm" columnindex="7"/> <result property="frstregisterpnttm" column="frst_register_pnttm" columnindex="8"/> </resultmap> SQL 작성 <select id="notificationdao.selectnotification" parameterclass="notificationvo" resultmap="notificationdetail" > <![CDATA[ SELECT a.ntfc_no, a.ntfc_sj, a.ntfc_cn, DATE_FORMAT(STR_TO_DATE(a.NTFC_TIME, '%Y%m%d%H%i%S'), '%Y-%m-%d %H:%i:%S') as NTFC_TIME, CONCAT(REPLACE(a.BH_NTFC_INTRVL, ',', ' 분,'), ' 분 ') as BH_NTFC_INTRVL, a.frst_register_id, ' 홍길동 ' as FRST_REGISTER_NM, DATE_FORMAT(a.FRST_REGISTER_PNTTM, '%Y-%m-%d %H:%i:%S') as FRST_REGISTER_PNTTM FROM COMTNNTFCINFO a WHERE a.ntfc_no = #ntfcno# ]]> </select> - 42 -

4. 예제어플리케이션개발 (21/43) 상세조회 (2/5) DAO 작성 public NotificationVO selectnotification(notificationvo searchvo) { return (NotificationVO)selectByPk("NotificationDAO.selectNotification", searchvo); Impl 작성 public NotificationVO selectnotification(notificationvo searchvo) throws Exception { NotificationVO resultvo = notificationdao.selectnotification(searchvo); if (resultvo == null) { throw processexception("info.nodata.msg"); return resultvo; Controller 작성 @RequestMapping("/guide/selectNotification.do") public String selectnotification(@modelattribute("searchvo") NotificationVO notificationvo, ModelMap model) throws Exception { LoginVO user = UserHelper.getUserInfo(); NotificationVO vo = notificationservice.selectnotification(notificationvo); model.addattribute("sessionuniqid", user.getuniqid()); model.addattribute("result", vo); return "guide/notificationdetail"; - 43 -

4. 예제어플리케이션개발 (22/43) 상세조회 (3/5) JSP(service 영역 javascript) <meta name="viewport" content="width=device-width, initial-scale=1"> <title> 알림이생성 </title> <link rel="stylesheet" href="/css/egovframework/mbl/cmm/jquery.mobile-1.0b1.min.css"/> <link rel="stylesheet" href="/css/egovframework/mbl/cmm/egovmobile.css" /> <script src="/js/egovframework/mbl/cmm/jquery-1.6.1.min.js"></script> <script src="/js/egovframework/mbl/cmm/jquery.mobile-1.0b1.min.js"></script> <script src="/js/egovframework/mbl/cmm/egovmobile.js"></script> <script type="text/javascript"> function fn_egov_select_notificationlist(pageno) { document.frm.pageindex.value = pageno; document.frm.action = "<c:url value='/guide/selectnotificationlist.do'/>"; document.frm.submit(); function fn_egov_delete_notification() { if (confirm('<spring:message code="common.delete.msg" />')) { document.frm.action = "<c:url value='/guide/deletenotification.do'/>"; document.frm.submit(); function fn_egov_moveupdt_notification() { document.frm.action = "<c:url value='/guide/updatenotificationpage.do'/>"; document.frm.submit(); </script> 알람목록이동 알람삭제 알람삭제 - 44 -

4. 예제어플리케이션개발 (23/43) 상세조회 (4/5) JSP(content 상세 ) <!-- content start --> <div data-role="content"> <p> 제목 : <c:out value="${result.ntfcsj" /></p> <p> 내용 : <c:out value="${result.ntfccn"/></p> <p> 알림시간 : <c:out value="${result.ntfctime" /></p> <p> 사전알림간격 : <c:out value="${result.bhntfcintrvlstring" /></p> <p> 작성자 : <c:out value="${result.frstregisternm" /></p> <p> 작성시간 : <c:out value="${result.frstregisterpnttm" /></p> 상세보기내용 <div class="ui-grid-b"> <div class="ui-block-a"> <a href="javascript:fn_egov_moveupdt_notification();" data-role="button"> 수정 </a></div> <div class="ui-block-b"> <a href="javascript:fn_egov_delete_notification();" data-role="button"> 삭제 </a></div> <div class="ui-block-b"> <a href="javascript:history.go(-1);" data-role="button"> 목록 </a></div> </div> button component </div> <!-- content end --> - 45 -

4. 예제어플리케이션개발 (24/43) 상세조회 (5/5) 결과 - 46 -

4. 예제어플리케이션개발 (25/43) 등록 SQL 작성 DAO 작성 Impl 작성 context-idgen.xml 작성 Validator 작성 JSP 작성 - 47 -

4. 예제어플리케이션개발 (26/43) 등록 (1/8) SQL 작성 <insert id="notificationdao.insertnotification" parameterclass="notificationvo" > <selectkey resultclass="java.lang.string" keyproperty="ntfcno"> SELECT IFNULL(MAX(NTFC_NO),0)+1 AS NTFC_NO FROM COMTNNTFCINFO </selectkey> <![CDATA[ INSERT INTO COMTNNTFCINFO (NTFC_NO, NTFC_SJ, NTFC_CN, NTFC_TIME, BH_NTFC_INTRVL, FRST_REGISTER_ID, FRST_REGISTER_PNTTM ) VALUES ( #ntfcno#, #ntfcsj#, #ntfccn#, #ntfctime#, #bhntfcintrvlstring#, #frstregisterid#, SYSDATE() ) ]]> </insert> DAO 작성 public String insertnotification(notificationvo notification) throws Exception { return (String)insert("NotificationDAO.insertNotification", notification); - 48 -

4. 예제어플리케이션개발 (27/43) 등록 (2/8) Impl 작성 public void insertnotification(notificationvo notification) throws Exception { StringBuffer time = new StringBuffer(); time.append(notification.getntfcdate().replaceall("-", "")); time.append(notification.getntfctime().replaceall(":", "")); time.append("00"); notification.setntfctime(time.tostring()); StringBuffer interval = new StringBuffer(); String[] array = notification.getbhntfcintrvl(); for (int i = 0; i < array.length; i++) { if (i!= 0) { interval.append(","); interval.append(array[i]); notification.setbhntfcintrvlstring(interval.tostring()); notificationdao.insertnotification(notification); - 49 -

4. 예제어플리케이션개발 (28/43) 등록 (3/8) Controller 작성 @RequestMapping("/guide/insertNotificationPage.do") public String insertnotificationpage(@modelattribute("searchvo") NotificationVO notificationvo, ModelMap model) throws Exception { NotificationVO notification = new NotificationVO(); model.addattribute("notification", notification); return "guide/notificationregist"; 등록 Page @RequestMapping("/guide/insertNotification.do") public String insertnotification(httpservletrequest request, @ModelAttribute("searchVO") NotificationVO notificationvo, @ModelAttribute("notification") NotificationVO notification, BindingResult bindingresult, SessionStatus status, ModelMap model) throws Exception { LoginVO user = UserHelper.getUserInfo(); Boolean isauthenticated = UserHelper.isAuthenticated(); beanvalidator.validate(notification, bindingresult); if (bindingresult.haserrors()) { return "guide/notificationregist ; if (!notificationservice.checknotification(notification)) { model.addattribute("msg", commonmessagesource.getmessage("template.guide.alertntfctime")); return "guide/notificationregist ; 알람등록 if (isauthenticated) { notification.setfrstregisterid(user.getuniqid()); notificationservice.insertnotification(notification); return "forward:/guide/selectnotificationlist.do"; - 50 -

4. 예제어플리케이션개발 (29/43) 등록 (4/8) Validator : dispatcher-servlet.xml 수정 <bean id="beanvalidator" class="org.springmodules.validation.commons.defaultbeanvalidator"> <property name="validatorfactory" ref="validatorfactory"/> </bean> <bean id="validatorfactory" class="org.springmodules.validation.commons.defaultvalidatorfactory"> <property name="validationconfiglocations"> <list> <value>/web-inf/config/egovframework/validator/validator-rules.xml</value> <value>/web-inf/config/egovframework/validator/validator.xml</value> </list> </property> </bean> - 51 -

4. 예제어플리케이션개발 (30/43) 등록 (5/8) Validator : NotificationRegist.xml 작성 <form-validation> <formset> <form name="notification"> <field property="ntfcsj" depends="required, maxlength"> <arg0 key="template.guide.ntfcsj" /> <arg1 key="30" resource="false"/> <var> <var-name>maxlength</var-name> <var-value>30</var-value> </var> </field> <field property="ntfccn" depends="required"> <arg0 key="template.guide.ntfccn" /> <arg1 key="50" resource="false"/> <var> <var-name>maxlength</var-name> <var-value>50</var-value> </var> </field> <field property="ntfcdate" depends="required"> <arg0 key="template.guide.ntfcdate" /> Validator-rules.xml </field> 작성 <field property="ntfchh" depends="required"> <arg0 key="template.guide.ntfctime" /> </field> <field property="bhntfcintrvl" depends="required"> <arg0 key="template.guide.bhntfcintrvl" /> </field> </form> </formset> </form-validation> - 52 -

4. 예제어플리케이션개발 (31/43) 등록 (6/8) JSP(service 영역 javascript) <%@ taglib prefix="validator" uri="http://www.springmodules.org/tags/commons-validator" %> <script type="text/javascript" src="<c:url value="/validator.do"/>"></script> <validator:javascript formname="notification" staticjavascript="false" xhtml="true" cdata="false"/> <script type="text/javascript"> function onloading() { if ("<c:out value='${msg'/>"!= "") { jalert("<c:out value='${msg'/>"); function fn_egov_regist_notification(){ if (!validatenotification(document.notification)){ return; var checked = false; for (var i = 0; i < document.notification.bhntfcintrvl.length; i++) { if (document.notification.bhntfcintrvl[i].checked) { checked = true; break; if (!checked) { jalert('<spring:message code="template.guide.bhntfcintrvl.msg" />'); return; if (confirm('<spring:message code="common.regist.msg" />')) { form = document.notification; form.action = "<c:url value='/guide/insertnotification.do'/>"; form.submit(); </script> validation 알람등록 javascript - 53 -

4. 예제어플리케이션개발 (32/43) 등록 (7/8) JSP(content 상세 ) <!-- content start --> <div data-role="content"> <input name="pageindex" type="hidden" value="<c:out value='${searchvo.pageindex'/>"/> <div data-role="fieldcontain"> <label for="ntfcsj"><spring:message code="template.guide.ntfcsj" /> *</label> <input type="text" id="ntfcsj" name="ntfcsj" /> </div> <div data-role="fieldcontain"> <label for="ntfccn"><spring:message code="template.guide.ntfccn" /> *</label> <textarea id="ntfccn" name="ntfccn"></textarea> </div> <div data-role="fieldcontain"> <label for="ntfcdate"><spring:message code="template.guide.ntfcdate" /> *</label> <input id="ntfcdate" name="ntfcdate" type="date" data-role="datebox" /> </div> <div data-role="fieldcontain"> <label for="ntfctime"><spring:message code="template.guide.ntfctime" /> *</label> <input id="ntfctime" name="ntfctime" type="date" data-role="datebox" data-options='{"mode": "timebox"' /> </div> <fieldset data-role="controlgroup"> <legend><spring:message code="template.guide.bhntfcintrvl" /> *</legend> <input type="checkbox" id="bhntfcintrvl1" name="bhntfcintrvl" value="1" class="custom" /><label for="bhntfcintrvl1">1 분 </label> <input type="checkbox" id="bhntfcintrvl2" name="bhntfcintrvl" value="3" class="custom" /><label for="bhntfcintrvl2">3 분 </label> <input type="checkbox" id="bhntfcintrvl3" name="bhntfcintrvl" value="5" class="custom" /><label for="bhntfcintrvl3">5 분 </label> <input type="checkbox" id="bhntfcintrvl4" name="bhntfcintrvl" value="10" class="custom" /><label for="bhntfcintrvl4">10 분 </label> <input type="checkbox" id="bhntfcintrvl5" name="bhntfcintrvl" value="30" class="custom" /><label for="bhntfcintrvl5">30 분 </label> </fieldset> <div class="ui-grid-a"> <div class="ui-block-a"><a href="javascript:fn_egov_regist_notification();" data-role="button"><spring:message code="button.create" /></a></div> <div class="ui-block-b"><a href="javascript:fn_egov_select_notification();" data-role="button"><spring:message code="button.list" /></a></div> </div> </div> <!-- content end --> Input Element Button Component - 54 -

4. 예제어플리케이션개발 (33/43) 등록 (8/8) 결과 - 55 -

4. 예제어플리케이션개발 (34/43) 수정 (1/6) SQL 작성 <update id="notificationdao.updatenotification" parameterclass="notificationvo"> <![CDATA[ UPDATE COMTNNTFCINFO SET NTFC_SJ = #ntfcsj#, NTFC_CN = #ntfccn#, NTFC_TIME = #ntfctime#, BH_NTFC_INTRVL = #bhntfcintrvlstring#, LAST_UPDUSR_ID = #lastupdusrid#, LAST_UPDUSR_PNTTM = SYSDATE() WHERE NTFC_NO = #ntfcno# ]]> </update> DAO 작성 public void updatenotification(notificationvo notification) throws Exception { update("notificationdao.updatenotification", notification); - 56 -

4. 예제어플리케이션개발 (35/43) 수정 (2/6) Impl 작성 public void updatenotifiction(notificationvo notification) throws Exception { StringBuffer time = new StringBuffer(); time.append(notification.getntfcdate().replaceall("-", "")); time.append(notification.getntfctime().replaceall(":", "")); time.append("00"); notification.setntfctime(time.tostring()); logger.debug("time : " + notification.getntfctime()); StringBuffer interval = new StringBuffer(); String[] array = notification.getbhntfcintrvl(); for (int i = 0; i < array.length; i++) { if (i!= 0) { interval.append(","); interval.append(array[i]); notification.setbhntfcintrvlstring(interval.tostring()); notificationdao.updatenotification(notification); - 57 -

4. 예제어플리케이션개발 (36/43) 수정 (3/6) Controller 작성 @RequestMapping("/guide/updateNotificationPage.do") public String updatenotificaitonpage(@modelattribute("searchvo") NotificationVO notificationvo, ModelMap model) throws Exception { NotificationVO vo = notificationservice.selectnotification(notificationvo); model.addattribute("result", vo); return "guide/notificationupdt ; 수정페이지이동 @RequestMapping("/guide/updateNotification.do") public String updatenotification(@modelattribute("searchvo") NotificationVO notificationvo, @ModelAttribute("notification") NotificationVO notification, BindingResult bindingresult, ModelMap model) throws Exception { LoginVO user = UserHelper.getUserInfo(); Boolean isauthenticated = UserHelper.isAuthenticated(); beanvalidator.validate(notification, bindingresult); if (bindingresult.haserrors()) { NotificationVO vo = notificationservice.selectnotification(notificationvo); model.addattribute("result", vo); return "guide/notificationupdt"; if (!notificationservice.checknotification(notification)) { model.addattribute("msg", commonmessagesource.getmessage("template.guide.alertntfctime")); NotificationVO vo = notificationservice.selectnotification(notificationvo); model.addattribute("result", vo); return "guide/notificationupdt ; if (isauthenticated) { notification.setlastupdusrid(user.getuniqid()); notificationservice.updatenotifiction(notification); return "forward:/guide/selectnotificationlist.do"; 알람수정 - 58 -

4. 예제어플리케이션개발 (37/43) 수정 (4/6) JSP(service 영역 javascript) function onloading() { if ("<c:out value='${msg'/>"!= "") { jalert("<c:out value='${msg'/>"); function fn_egov_update_notification(){ if (!validatenotification(document.notification)){ return; var checked = false; for (var i = 0; i < document.notification.bhntfcintrvl.length; i++) { if (document.notification.bhntfcintrvl[i].checked) { checked = true; break; if (!checked) { jalert('<spring:message code="template.guide.bhntfcintrvl.msg" />'); return; if (confirm('<spring:message code="common.update.msg" />')) { form = document.notification; form.action = "<c:url value='/guide/updatenotification.do'/>"; form.submit(); function fn_egov_select_notification(){ var form = document.notification; form.action = "<c:url value='/guide/selectnotificationlist.do'/>"; form.submit(); validation 알람수정 javascript - 59 -

4. 예제어플리케이션개발 (38/43) 수정 (5/6) JSP(content 상세 ) <!-- content start --> <div data-role="content"> <div data-role="fieldcontain"> <label for="ntfcsj"><spring:message code="template.guide.ntfcsj" /> *</label> <input type="text" id="ntfcsj" name="ntfcsj" value="<c:out value="${result.ntfcsj"/>" /> </div> <div data-role="fieldcontain"> <label for="ntfccn"><spring:message code="template.guide.ntfccn" /> *</label> <textarea id="ntfccn" name="ntfccn"><c:out value="${result.ntfccn" escapexml="true" /></textarea> </div> <div data-role="fieldcontain"> <label for="ntfcdate"><spring:message code="template.guide.ntfcdate" /> *</label> <input id="ntfcdate" name="ntfcdate" type="date" data-role="datebox" value="<c:out value='${fn:substring(result.ntfctime, 0, 10)'/>" /> </div> <div data-role="fieldcontain"> <label for="ntfctime"><spring:message code="template.guide.ntfctime" /> *</label> <input id="ntfctime" name="ntfctime" type="date" data-role="datebox" data-options='{"mode": "timebox"' value="<c:out value='${fn:substring(result.ntfctime, 11, 16)'/>"/> </div> <div class="ui-grid-a"> <div class="ui-block-a"><a href="javascript:fn_egov_update_notification();" data-role="button"><spring:message code="button.update" /></a></div> <div class="ui-block-b"><a href="javascript:fn_egov_select_notification();" data-role="button"><spring:message code="button.list" /></a></div> </div> Input Element </div> <!-- content end --> Button Component - 60 -

4. 예제어플리케이션개발 (39/43) 수정 (6/6) 결과 - 61 -

4. 예제어플리케이션개발 (40/43) 삭제 (1/4) SQL 작성 <update id="notificationdao.deletenotification" parameterclass="notificationvo"> <![CDATA[ DELETE FROM COMTNNTFCINFO WHERE NTFC_NO = #ntfcno# ]]> </update> DAO 작성 public void deletenotification(notificationvo notification) throws Exception { update("notificationdao.deletenotification", notification); - 62 -

4. 예제어플리케이션개발 (41/43) 삭제 (2/4) Impl 작성 public void deletenotifiction(notificationvo notification) throws Exception { notificationdao.deletenotification(notification); Controller 작성 @RequestMapping("/guide/deleteNotification.do") public String deletenotification(@modelattribute("searchvo") NotificationVO notificationvo, @ModelAttribute("notification") NotificationVO notification, SessionStatus status) throws Exception { LoginVO user = UserHelper.getUserInfo(); Boolean isauthenticated = UserHelper.isAuthenticated(); if (isauthenticated) { notification.setlastupdusrid(user.getuniqid()); notificationservice.deletenotifiction(notification); return "forward:/guide/selectnotificationlist.do"; - 63 -

4. 예제어플리케이션개발 (42/43) 수정 (3/4) JSP(service 영역 javascript) <script type="text/javascript"> function fn_egov_moveupdt_notification() { document.frm.action = "<c:url value='/guide/updatenotificationpage.do'/>"; document.frm.submit(); </script> 삭제 script <!-- content start --> <div data-role="content"> <p> 제목 : <c:out value="${result.ntfcsj" /></p> <p> 내용 : <c:out value="${result.ntfccn"/></p> <p> 알림시간 : <c:out value="${result.ntfctime" /></p> <p> 사전알림간격 : <c:out value="${result.bhntfcintrvlstring" /></p> <p> 작성자 : <c:out value="${result.frstregisternm" /></p> <p> 작성시간 : <c:out value="${result.frstregisterpnttm" /></p> <div class="ui-grid-b"> <div class="ui-block-a"><a href="javascript:fn_egov_moveupdt_notification(); data-role="button"> 수정 </a></div> <div class="ui-block-b"><a href="javascript:fn_egov_delete_notification();" data-role="button"> 삭제 </a></div> <div class="ui-block-b"><a href="javascript:history.go(-1);" data-role="button"> 목록 </a></div> </div> Button Component </div> <!-- content end --> - 64 -

4. 예제어플리케이션개발 (43/43) 삭제 (6/6) 결과 - 65 -

5. 참조 (1/2) AbstractServiceImpl 기본메소드 EgovBizException 발생을위한메소드 protected Exception processexception(final String msgkey) protected Exception processexception(final String msgkey, Exception e) protected Exception processexception(final String msgkey, final String[] msgargs) protected Exception processexception(final String msgkey, final String[] msgargs, final Exception e) protected Exception processexception(final String msgkey, final String[] msgargs, final Exception e, Locale locale) protected Exception processexception(final String msgkey, final String[] msgargs, final Exception e, final Locale locale, ExceptionCreator exceptioncreator) Exception 발생없이후처리로직실행을위한메소드 protected void leaveatrace(string msgkey) protected void leaveatrace(string msgkey, String[] msgargs) protected void leaveatrace(string msgkey, String[] msgargs, Locale locale) - 66 -

5. 참조 (2/2) EgovAbstractDAO ibatis 의 SqlMapClientDaoSupport 확장 입력처리 SQL mapping 을실행한다. public Object insert(string queryid, Object parameterobject) 수정처리 SQL mapping 을실행한다. public int update(string queryid, Object parameterobject) 삭제처리 SQL mapping 을실행한다. public int delete(string queryid, Object parameterobject) pk 를조건으로한단건조회처리 SQL mapping 을실행한다. public Object selectbypk(string queryid, Object parameterobject) 리스트조회처리 SQL mapping 을실행한다. public List list(string queryid, Object parameterobject) 부분범위리스트조회처리 SQL mapping 을실행한다. ( 부분범위 - pageindex 와 pagesize 기반으로현재부분범위조회를위한 skipresults, maxresults 를계산하여 ibatis 호출 ) public List listwithpaging(string queryid, Object parameterobject, int pageindex, int pagesize) - 67 -