표준프레임워크로구성된컨텐츠를솔루션에적용 1. sample( 게시판 ) 프로젝트생성 - egovframe Web Project next generate example finish 2. 프로젝트추가 - 프로젝트 Import 3. 프로젝트에 sample 프로젝트의컨텐츠를추가, 기능동작확인 ⓵ sample 프로젝트에서 프로젝트로복사 sample > egovframework > example > egovframework ⓶ EgovSampleController 의 return 경로수정 (JSP) - return egovframework/example/aa/aa ; resources ⓵ sample 프로젝트에서 프로젝트로복사 sample resources > db resources > egovframework > message > message-common_en.properties resources > egovframework > message > message-common_ko.properties resources > egovframework > message > message-common.properties resources > egovframework > sqlmap > example resources resources > egovframework > message > com resources > egovframework > message > com resources > egovframework > message > com resources > egovframework > sqlmap ⓶ 소스수정 (resources > egovframework > spring) * context-datasource.xml 소스추가 <jdbc:embedded-database id="datasource2" type="hsql"> <jdbc:script location= "classpath:/db/sampledb.sql"/> </jdbc:embedded-database> * context-idgen.xml 소스추가 <bean name="egovidgnrservice" class="egovframework.rte.fdl.idgnr.impl.egovtableidgnrserviceimpl" destroy-method="destroy"> <property name="datasource" ref="datasource2" /> <property name="strategy" ref="mixprefixsample" /> <property name="blocksize" value="10"/> <property name="table" value="ids"/> <property name="tablename" value="sample"/> <bean name="mixprefixsample" class="egovframework.rte.fdl.idgnr.impl.strategy.egovidgnrstrategyimpl"> <property name="prefix" value="sample-" /> <property name="cipers" value="5" /> <property name="fillchar" value="0" /> * context-sqlmap.xml 소스추가 <bean id="sqlmapclient" class="egovframework.rte.psl.orm.ibatis.sqlmapclientfactorybean"> - 1 -
<property name="configlocation" value="classpath:/egovframework/sqlmap/example/sql-map-config.xml"/> <property name="datasource" ref="datasource2"/> * context-validator.xml 소스수정 <bean id="validatorfactory" class="org.springmodules.validation.commons.defaultvalidatorfactory"> <property name="validationconfiglocations"> <list> <!-- 경량환경템플릿밸리데이터설정 --> <!-- <value>classpath:/egovframework/validator/validator-rules-let.xml</value> <value>classpath:/egovframework/validator/let/**/*.xml</value> --> <value>/web-inf/config/egovframework/validator/validator-rules.xml</value> <value>/web-inf/config/egovframework/validator/validator.xml</value> </list> </property> ⓵ sample 프로젝트에서 프로젝트로복사 sample > css > egovframework > images > egovframework > WEB-INF > jsp > egovframework > WEB-INF > config > egovframework > validator > css > images > WEB-INF > jsp > WEB-INF > config > egovframework ⓶ 소스수정 ( > WEB-INF > config > egovframework > springmvc) * nforu-servlet.xml 소스내용추가 / 수정 <mvc:interceptors> <mvc:mapping path="/**/*.do" /> <mvc:exclude-mapping path="/*sample*.do"/> <mvc:exclude-mapping path="/cmmn/*.do"/> <bean class="egovframework.nfu.com.interceptor.systembaseinterceptor" /> <mvc:mapping path="/apple/**/*.do" /> <mvc:exclude-mapping path="/*sample*.do"/> <mvc:exclude-mapping path="/cmmn/*.do"/> <bean class="egovframework.nfu.com.interceptor.authenticinterceptor" /> </mvc:interceptors> <mvc:view-controller path="/cmmn/validator.do" view-name="cmm/validator"/> - 2 -
표준프레임워크프로젝트와솔루션연동 1. Simple Homepage Template 프로젝트생성 ( 프로젝트명 : sht) 2. DB통합 - 솔루션의 DB에맞춰 Simple Homepage Template 프로젝트 DB 설정변경및 DB정보생성 - 기본적용된 hsqldb와함께솔루션 DB 이중구성설정 3. 솔루션을 Simple Homepage Template 프로젝트에적용하여상호기능동작확인 4. Simple Homepage Template 프로젝트와솔루션의권한처리공유 (sht 계정 : admin / 1) - Simple Homepage Template 프로젝트에로그인하여솔루션의로그인후권한이적용되도록수정 - 솔루션에로그인하여 Simple Homepage Template 프로젝트의로그인후권한이적용되도록수정 ( 로그아웃도동일하게적용되도록수정 ) DB 설정 ⓵ 소스수정 * global.properties (resources > egovframework > egovprops) 소스내용추가 # 웹루트절대경로 (WINDOWS, UNIX) Globals.WebRoot = 경로 Globals.DbType2 = oracle Globals.UserName2= 계정 Globals.Password2= 암호 Globals.DriverClassName2=oracle.jdbc.driver.OracleDriver Globals.Url2=jdbc:oracle:thin:@115.94.11.20:1521:test # 파일업로드관련설정--------------------------------------------------------------------------------------- # 파일업로드 MAX SIZE Globals.maxUploadSize = 1000000000 Globals.maxInMemorySize = 1048 # 파일업로드가능파일 Globals.fileAllowExt = gul xls xlsx doc docx hwp pdf ppt pptx jpg gif bmp jpeg psd pdf png zip txt Globals.imgAllowExt = jpg gif bmp jpeg png Globals.flashAllowExt = swf Globals.docAllowExt = gul doc docx hwp pdf ppt pptx jpg gif bmp jpeg psd pdf png dwg dxf dwt dwf iges step kosdic stl cals Globals.fileAllowExt.msg = 이미지와문서파일만업로드가능합니다 Globals.imgAllowExt.msg = 이미지파일만업로드가능합니다 # 파일업로드경로 ( 경로설정은반드시절대경로를사용해야함, 경로뒤에 / 를붙여주어야함.) Globals.fileStorePath = Globals.WebRoot 경로 /upload Globals.docFileStorePath = Globals.WebRoot 경로 /doc # 웹에디터파일업로드경로 ( 경로설정은반드시절대경로를사용해야함, 경로뒤에 / 를붙여주어야함.) Globals.webeditorfileStorePath = Globals.WebRoot 경로 /webeditor # 파일동기화컴포넌트에서사용할파일업로드경로 ( 경로설정은반드시절대경로를사용해야함, 경로뒤에 / 를붙여주어야함.) Globals.SynchrnServerPath = Globals.WebRoot 경로 /temp # 파일업로드관련설정 ---------------------------------------------------------------------------------------// # Aes 암 / 복호화 Key 설정 Globals.AesSecretKey = v3aessecret - 3 -
# 파일확장자별타입 Globals.imgFileType = jpg gif bmp jpeg png Globals.docFileType = doc docx hwp pdf ppt pptx xls xlsx txt Globals.vodFileType = avi mp4 mpeg wmv asf # SSL 로만접속되도록설정 ( Y: SSL 로접속, A: HTTP/SSL 모두사용, N: HTTP 만사용 ) Globals.sslConn = N * context-datasource.xml (resources > egovframework > spring > com) 소스내용수정 <!-- Oracle --> <bean id="datasource-oracle" class="org.apache.commons.dbcp.basicdatasource" destroy-method="close"> <property name="driverclassname" value="${globals.driverclassname2"/> <property name="url" value="${globals.url2" /> <property name="username" value="${globals.username2"/> <property name="password" value="${globals.password2"/> * context-sqlmap.xml (resources > egovframework > spring > com) 소스내용추가 <bean id="sqlsession" class="org.mybatis.spring.sqlsessionfactorybean" lazy-init="true"> <property name="configlocation"> <value>classpath:/egovframework/sqlmap/config/${globals.dbtype2/sql-map-config-${globals.dbtype2-nfu.xml</value> </property> <property name="mapperlocations"> <value>classpath:/egovframework/sqlmap/mapper/${globals.dbtype2/**/*_${globals.dbtype2.xml</value> </property> <property name="datasource" ref="datasource-${globals.dbtype2"/> * context-common.xml (resources > egovframework > spring > com) 소스내용추가 <!-- 추가 170731 globalspropertiest --> <bean id="globalsproperties" class="org.springframework.beans.factory.config.propertiesfactorybean"> <property name="location" value="classpath:/egovframework/egovprops/globals.properties"/> * egov-com-servlet.xml ( > WEB-INF > config > egovframework > springmvc) 소스내용추가, 수정 <mvc:mapping path="/**/*.do" /> <mvc:exclude-mapping path="/validator.do"/> <mvc:exclude-mapping path="/egovpagelink.*"/> <mvc:exclude-mapping path="/cmm/*/*.do"/> <mvc:exclude-mapping path="/cop/**/*.do"/> <mvc:exclude-mapping path="/*/cmm/*.do"/> <mvc:exclude-mapping path="/cop/com/*.do"/> <mvc:exclude-mapping path="/cop/bbs/*master*.do"/> <mvc:exclude-mapping path="/uat/uia/*.do"/> <mvc:exclude-mapping path="/uat/uia/actionlogin.do"/> <mvc:exclude-mapping path="/uat/uia/egovloginusr.do"/> <bean class="egovframework.nfu.com.interceptor.systembaseinterceptor" /> <mvc:mapping path="/apple/**/*.do" /> <bean class="egovframework.nfu.com.interceptor.authenticinterceptor" /> <!-- Annotation 을사용하지않는경우에대한 MVC 처리설정 --> <mvc:view-controller path="/cmmn/validator.do" view-name="cmm/validator"/> - 4 -
<!-- <mvc:annotation-driven/> --> <mvc:annotation-driven> <mvc:argument-resolvers> <bean class="egovframework.nfu.utl.customargumentresolver"> </mvc:argument-resolvers> </mvc:annotation-driven> ⓵ 프로젝트에서 sht 프로젝트로복사 sht > MybatisUtils. > poicombosample. > egovframework > nfu > egovframework resources ⓵ 프로젝트에서 sht 프로젝트로복사 resources > egovframework > sqlmap > config > oracle > sql-map-config-oracle-nfu.xml resources > egovframework > sqlmap > mapper sht resources > egovframework > sqlmap > config > oracle resources > egovframework > sqlmap ⓵ 프로젝트에서 sht 프로젝트로복사 sht > css ( 덮어쓰기 ) > font > editor > images ( 덮어쓰기 ) > js ( 덮어쓰기 ) > upload ( 생성 ) > WEB-INF > lib > WEB-INF > jsp > nfu > WEB-INF > WEB-INF > jsp ⓶ Java Build Path Web App Libraries 추가 (sht) - 5 -
권한적용 ( 소스수정 ) ⓵ lologincontroller public void login( @PathVariable("ctx") String sysid,httpservletrequest request, HttpServletResponse response,commonmap commonmap, ModelMap model) {... if(confmyn.equals("y")){ // 가입승인... //URL 가져오기 String conect_url = request.getrequesturl().tostring(); commonmap.put("conect_url",conect_url); commonmap.put("conect_ty", "ID/PW"); commonmap.putall(mberinfo); commonservice.insertquery("insertmberaccesinfo", commonmap.getmap()); /* sht 로그인 */ LoginVO resultvo = new LoginVO(); resultvo.setid(mberinfo.get("mberid").tostring()); resultvo.setname(mberinfo.get("mbernm").tostring()); resultvo.setuniqid("usrcnfrm_00000000000"); resultvo.setuserse("usr"); request.getsession().setattribute("loginvo", resultvo); public String logout( @PathVariable("ctx") String sysid,httpservletrequest request, HttpServletResponse response,commonmap commonmap, ModelMap model) {... //URL 가져오기 String conect_url = request.getrequesturl().tostring(); commonmap.put("conect_url",conect_url); commonmap.put("conect_ty", "Logout"); commonmap.putall(mberinfo); /* sht 로그아웃 */ RequestContextHolder.getRequestAttributes().removeAttribute("LoginVO", RequestAttributes.SCOPE_SESSION); try { commonservice.insertquery("insertmberaccesinfo", commonmap.getmap()); catch (IOException e) { log.debug(" lologincontroller[logout] IOException : " + e.getmessage()); catch (SQLException e) { log.debug(" lologincontroller[logout] SQLException : " + e.getmessage()); session.invalidate();// 세션종료 model.addattribute("logoutsysid", sysid); return "nfu/co/lo/logout"; ⓶ EgovLoginController public String actionlogin(@modelattribute("loginvo") LoginVO loginvo, HttpServletRequest request, ModelMap model) throws Exception { // 1. 일반로그인처리 LoginVO resultvo = loginservice.actionlogin(loginvo); boolean loginpolicyyn = true; if (resultvo!= null && resultvo.getid()!= null &&!resultvo.getid().equals("") && loginpolicyyn) { request.getsession().setattribute("loginvo", resultvo); /* 로그인처리 */ Map<String, Object> mberinfo = new HashMap<String, Object>(); mberinfo.put("mberid", resultvo.getid()); mberinfo.put("mbernm", resultvo.getname()); mberinfo.put("insttcode", " A100000000"); mberinfo.put("insttnm", " 인천교직원수련원 "); - 6 -
Map<String, Object> authinfo = new HashMap<String, Object>(); authinfo.put("sysid", "apple"); authinfo.put("authorcode", "1"); List<Map<String, Object>> authlist = new ArrayList<Map<String, Object>>(); authlist.add(0, authinfo); mberinfo.put("authlist", authlist); HttpSession session = request.getsession(); session.setattribute(session.getid()+"_ssmberinfo_sample", mberinfo); session.setattribute(session.getid()+"_ssmberinfo_apple", mberinfo); /*// 로그인처리 */ else { return "forward:/cmm/main/mainpage.do"; model.addattribute("message", egovmessagesource.getmessage("fail.common.login")); return "cmm/uat/uia/egovloginusr"; public String actionlogout(httpservletrequest request, ModelMap model) throws Exception { RequestContextHolder.getRequestAttributes().removeAttribute("LoginVO", RequestAttributes.SCOPE_SESSION); /* 솔루션로그아웃 */ HttpSession session = request.getsession(); session.invalidate(); return "forward:/cmm/main/mainpage.do"; - 7 -