반응형
Notice
Recent Posts
Recent Comments
Link
지구정복
[전자정부프레임워크] 02/02 | 전자정부프레임워크(심플프로젝트사용, 모바일 웹 프로젝트 사용) 본문
데이터 엔지니어링 정복/HTML-CSS-JavaScript-Spring-Node.js
[전자정부프레임워크] 02/02 | 전자정부프레임워크(심플프로젝트사용, 모바일 웹 프로젝트 사용)
nooh._.jl 2021. 2. 2. 12:39728x90
반응형
복습 및 배울내용
전자정부프레임워크
= Spring / MyBatis
<= Java / JSP / Servlet (html/css/Javascript) + 데이터베이스 (이 내용들을 알아야함)
* System( OS / WebServer )
+ Git / 턱시도 ....
* Spring + 데이터베이스
* library + 설정파일
1. Java
2. JdbcTemplate
3. MyBatis
* 전자정부프레임워크
기본적인 프로그램 템플리트(가상 디자인)를 제공한다.
* 프로그램적 골격을 제공
* 게시판 구조를 메모리 DB
* System을 배울 때는 가상머신을 사용한다.
하드웨어에 대한 가상화 -> 기존 하드웨어 위에 가상의 하드웨어를 만드는 것
* 주의사항
1. cpu는 intel이고 최신버전이어야한다.
2. cpu와 메인보드가 Virtualization(가상)을 지원해야 한다.
3. 속도가 느려진다.
4. 윈도우 업데이트
가상머신을 만드는 툴
1. VMWare - VMWare사 제작( 유료와 무료 있음, 주로 많이 사용 )
2. VitualBox - Oracle사 무료
리눅스 프로그램
1. 전자정부 프레임워크 사용
더보기
1. 전자정부프레임워크
심플 프로젝트를 만들고
DATABASE 폴더에서 all_sht_ddl_mysql.sql의 내용을 마리아디비에 추가한다.
먼저 어제 만든 ids, sample 테이블을 삭제한다.
다음으로 all_sht_ddl_mysql.sql의 쿼리문을 모두 복사해서 테이블을 만든다.
다음으로 all_sht_data_mysql.sql에 있는 데이터들도 모두 집어넣는다.
다음으로 pom.xml에 라이브러리를 추가한다.
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.exam</groupId>
<artifactId>tegov02</artifactId>
<packaging>war</packaging>
<version>1.0.0</version>
<name>tegov02</name>
<url>http://www.egovframe.go.kr</url>
<licenses>
<license>
<name>The Apache Software License, Version 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
</license>
</licenses>
<properties>
<spring.maven.artifact.version>4.3.22.RELEASE</spring.maven.artifact.version>
<egovframework.rte.version>3.9.0</egovframework.rte.version>
</properties>
<repositories>
<repository>
<id>mvn2s</id>
<url>https://repo1.maven.org/maven2/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<repository>
<id>egovframe</id>
<url>http://maven.egovframe.kr:8080/maven/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>egovframe2</id>
<url>http://www.egovframe.go.kr/maven/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>egovframework.rte</groupId>
<artifactId>egovframework.rte.ptl.mvc</artifactId>
<version>${egovframework.rte.version}</version>
</dependency>
<dependency>
<groupId>egovframework.rte</groupId>
<artifactId>egovframework.rte.psl.dataaccess</artifactId>
<version>${egovframework.rte.version}</version>
</dependency>
<dependency>
<groupId>egovframework.rte</groupId>
<artifactId>egovframework.rte.fdl.idgnr</artifactId>
<version>${egovframework.rte.version}</version>
</dependency>
<dependency>
<groupId>egovframework.rte</groupId>
<artifactId>egovframework.rte.fdl.property</artifactId>
<version>${egovframework.rte.version}</version>
</dependency>
<dependency>
<groupId>egovframework.rte</groupId>
<artifactId>egovframework.rte.fdl.string</artifactId>
<version>${egovframework.rte.version}</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<scope>provided</scope>
<version>2.5</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>commons-dbcp</groupId>
<artifactId>commons-dbcp</artifactId>
<version>1.4</version>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.9</version>
</dependency>
<dependency>
<groupId>taglibs</groupId>
<artifactId>standard</artifactId>
<version>1.1.2</version>
</dependency>
<dependency>
<groupId>cglib</groupId>
<artifactId>cglib</artifactId>
<version>3.1</version>
</dependency>
<dependency>
<groupId>org.antlr</groupId>
<artifactId>antlr</artifactId>
<version>3.5</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-compress</artifactId>
<version>1.8.1</version>
</dependency>
<dependency>
<groupId>org.mariadb.jdbc</groupId>
<artifactId>mariadb-java-client</artifactId>
<version>2.7.1</version>
</dependency>
<!--
<dependency>
<groupId>org.hsqldb</groupId>
<artifactId>hsqldb</artifactId>
<version>2.3.2</version>
</dependency>
-->
<!-- mysql driver -->
<!--
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.31</version>
</dependency>
-->
<!-- oracle 10g driver -->
<!--
<dependency>
<groupId>ojdbc</groupId>
<artifactId>ojdbc</artifactId>
<version>14</version>
</dependency>
-->
<!-- altibase driver -->
<!--
<dependency>
<groupId>altibase</groupId>
<artifactId>altibase-jdbc-driver</artifactId>
<version>5.1.3.18</version>
</dependency>
-->
<!-- tibero driver -->
<!--
<dependency>
<groupId>com.tmax.tibero</groupId>
<artifactId>tibero-jdbc</artifactId>
<version>3.0</version>
</dependency> -->
<!-- cubrid driver -->
<!--
<dependency>
<groupId>cubrid</groupId>
<artifactId>cubrid-jdbc</artifactId>
<version>8.4</version>
</dependency>
-->
<!-- log4jdbc driver -->
<dependency>
<groupId>com.googlecode.log4jdbc</groupId>
<artifactId>log4jdbc</artifactId>
<version>1.2</version>
<exclusions>
<exclusion>
<artifactId>slf4j-api</artifactId>
<groupId>org.slf4j</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>1.3.1</version>
</dependency>
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
<version>2.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.ibm.icu</groupId>
<artifactId>icu4j</artifactId>
<version>53.1</version>
</dependency>
</dependencies>
<build>
<defaultGoal>install</defaultGoal>
<directory>${basedir}/target</directory>
<finalName>sht_webapp</finalName>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<port>80</port>
<path>/</path>
<systemProperties>
<JAVA_OPTS>-Xms256m -Xmx768m -XX:MaxPermSize=256m</JAVA_OPTS>
</systemProperties>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>hibernate3-maven-plugin</artifactId>
<version>2.1</version>
<configuration>
<components>
<component>
<name>hbm2ddl</name>
<implementation>annotationconfiguration</implementation>
</component>
</components>
</configuration>
<dependencies>
<dependency>
<groupId>org.hsqldb</groupId>
<artifactId>hsqldb</artifactId>
<version>2.3.2</version>
</dependency>
</dependencies>
</plugin>
<!-- EMMA -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>emma-maven-plugin</artifactId>
<version>1.0-alpha-3</version>
</plugin>
<!-- PMD manven plugin -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-pmd-plugin</artifactId>
<version>3.1</version>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<!-- EMMA -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skipTests>true</skipTests>
<forkMode>once</forkMode>
<reportFormat>xml</reportFormat>
<excludes>
<exclude>**/Abstract*.java</exclude>
<exclude>**/*Suite.java</exclude>
</excludes>
<includes>
<include>**/*Test.java</include>
</includes>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>emma-maven-plugin</artifactId>
<inherited>true</inherited>
</plugin>
<!-- JavaDoc -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.9.1</version>
</plugin>
</plugins>
</build>
<reporting>
<outputDirectory>${basedir}/target/site</outputDirectory>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>2.7</version>
<reportSets>
<reportSet>
<id>sunlink</id>
<reports>
<report>javadoc</report>
</reports>
<inherited>true</inherited>
<configuration>
<links>
<link>http://docs.oracle.com/javase/6/docs/api/</link>
</links>
</configuration>
</reportSet>
</reportSets>
</plugin>
<!-- JUnit Test Results & EMMA Coverage Reporting -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>emma-maven-plugin</artifactId>
<inherited>true</inherited>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>surefire-report-maven-plugin</artifactId>
<inherited>true</inherited>
<reportSets>
<reportSet>
<reports>
<report>report-only</report>
</reports>
</reportSet>
</reportSets>
</plugin>
<!-- Generating JavaDoc Report -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<minmemory>128m</minmemory>
<maxmemory>512m</maxmemory>
<encoding>${encoding}</encoding>
<docencoding>${encoding}</docencoding>
<charset>${encoding}</charset>
</configuration>
</plugin>
<!-- Generating Java Source in HTML -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jxr-plugin</artifactId>
<configuration>
<inputEncoding>${encoding}</inputEncoding>
<outputEncoding>${encoding}</outputEncoding>
<linkJavadoc>true</linkJavadoc>
<javadocDir>apidocs</javadocDir>
</configuration>
</plugin>
</plugins>
</reporting>
</project>
그리고 src/main/resources/egovframework/egovProps에 globals.properties를 마리아디비용으로 설정해준다.
#-----------------------------------------------------------------------
#
# globals.properties : 시스템
#
#-----------------------------------------------------------------------
# 1. key = value 구조입니다.
# 2. key값은 공백문자를 포함불가, value값은 공백문자를 가능
# 3. key값으로 한글을 사용불가, value값은 한글사용이 가능
# 4. 줄을 바꿀 필요가 있으면 '\'를 라인의 끝에 추가(만약 '\'문자를 사용해야 하는 경우는 '\\'를 사용)
# 5. Windows에서의 디렉토리 표시 : '\\' or '/' ('\' 사용하면 안됨)
# 6. Unix에서의 디렉토리 표시 : '/'
# 7. 주석문 처리는 #사용
# 8. value값 뒤에 스페이스가 존재하는 경우 서블릿에서 참조할때는 에러발생할 수 있으므로 trim()하거나 마지막 공백없이 properties 값을 설정할것
#-----------------------------------------------------------------------
# 운영서버 타입(WINDOWS, UNIX)
Globals.OsType = WINDOWS
# G4C 연결용 IP (localhost)
Globals.LocalIp = 127.0.0.1
# DB서버 타입(mysql,oracle,altibase,tibero) - datasource 및 sqlMap 파일 지정에 사용됨
Globals.DbType = mysql
Globals.UserName=project
Globals.Password=123456
#mariaDB
Globals.DriverClassName=org.mariadb.jdbc.Driver
Globals.Url=jdbc:mysql://127.0.0.1:3307/project
# mysql
#Globals.DriverClassName=net.sf.log4jdbc.DriverSpy
#Globals.Url=jdbc:mysql://127.0.0.1:3306/sht
#oracle
#Globals.DriverClassName=oracle.jdbc.driver.OracleDriver
#Globals.Url=jdbc:oracle:thin:@127.0.0.1:1521:egovfrm
#Altibase
#Globals.DriverClassName=Altibase.jdbc.driver.AltibaseDriver
#Globals.Url=jdbc:Altibase://127.0.0.1:1721/egovfrm?encoding=UTF-8
#Tibero
#Globals.DriverClassName=com.tmax.tibero.jdbc.TbDriver
#Globals.Url=jdbc:tibero:thin:@127.0.0.1:1821:egovfrm
#cubrid
#Globals.DriverClassName=cubrid.jdbc.driver.CUBRIDDriver
#Globals.Url=jdbc:cubrid:127.0.0.1:33000:sht:::?charset=utf-8
#Hsql - local hssql 사용시에 적용
#Globals.DriverClassName=net.sf.log4jdbc.DriverSpy
#Globals.Url=jdbc:log4jdbc:hsqldb:hsql://127.0.0.1/sampledb
# MainPage Setting
Globals.MainPage = /cmm/main/mainPage.do
다음으로 spring/com에 context-datasource.xml을 수정한다.
여기서 Globals.~은 위에서 설정한 globals.properties에서 내용을 가져오는 것이다.
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jdbc="http://www.springframework.org/schema/jdbc"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-4.0.xsd">
<!-- 환경설정 기본정보를 globals.properties 에서 참조하도록 propertyConfigurer 설정 -->
<bean id="propertyConfigurer"
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<list>
<value>classpath:/egovframework/egovProps/globals.properties</value>
<!-- value>file:/product/jeus/egovProps/globals.properties</value-->
</list>
</property>
</bean>
<!-- datasource 설정(propertyConfigurer 활용) -->
<alias name="dataSource-${Globals.DbType}" alias="dataSource" />
<alias name="dataSource-${Globals.DbType}" alias="egov.dataSource" />
<!-- hsql
<jdbc:embedded-database id="dataSource-hsql" type="HSQL">
<jdbc:script location= "classpath:/db/shtdb.sql"/>
</jdbc:embedded-database>
-->
<!-- <bean id="dataSource-hsql" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<property name="driverClassName" value="net.sf.log4jdbc.DriverSpy"/>
<property name="url" value="jdbc:log4jdbc:hsqldb:hsql://localhost/sampledb"/>
<property name="username" value="sa"/>
</bean> -->
<!-- mysql -->
<bean id="dataSource-mysql" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<property name="driverClassName" value="${Globals.DriverClassName}"/>
<property name="url" value="${Globals.Url}" />
<property name="username" value="${Globals.UserName}"/>
<property name="password" value="${Globals.Password}"/>
</bean>
<!-- Oracle -->
<bean id="dataSource-oracle" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<property name="driverClassName" value="${Globals.DriverClassName}"/>
<property name="url" value="${Globals.Url}" />
<property name="username" value="${Globals.UserName}"/>
<property name="password" value="${Globals.Password}"/>
</bean>
<!-- Altibase -->
<bean id="dataSource-altibase" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<property name="driverClassName" value="${Globals.DriverClassName}"/>
<property name="url" value="${Globals.Url}" />
<property name="username" value="${Globals.UserName}"/>
<property name="password" value="${Globals.Password}"/>
<property name="maxActive" value="10"/>
</bean>
<!-- Tibero -->
<bean id="dataSource-tibero" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<property name="driverClassName" value="${Globals.DriverClassName}"/>
<property name="url" value="${Globals.Url}" />
<property name="username" value="${Globals.UserName}"/>
<property name="password" value="${Globals.Password}"/>
</bean>
<!-- cubrid -->
<bean id="dataSource-cubrid" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<property name="driverClassName" value="${Globals.DriverClassName}"/>
<property name="url" value="${Globals.Url}" />
<property name="username" value="${Globals.UserName}"/>
<property name="password" value="${Globals.Password}"/>
</bean>
</beans>
각 데이터베이스에 대한 sql문은 sqlmap에 들어가 있다.
이제 index.jsp를 실행하면 정상작동된다.
모바일 웹화면을 만들어보자.
MObile project는 게시판이고 template project는 여러가지 형태가 있는것이다.
새로운 Mobile project를 만든다.
728x90
반응형
'데이터 엔지니어링 정복 > HTML-CSS-JavaScript-Spring-Node.js' 카테고리의 다른 글
Comments