1. 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.lalwr</groupId >
<artifactId > place</artifactId >
<name > place</name >
<packaging > war</packaging >
<version > 1.0.0-BUILD-SNAPSHOT</version >
<properties >
<java-version > 1.8</java-version >
<org.springframework-version > 4.3.2.RELEASE</org.springframework-version >
<org.aspectj-version > 1.7.3</org.aspectj-version >
<org.slf4j-version > 1.6.6</org.slf4j-version >
</properties >
<repositories >
<repository >
<id > mvn2</id >
<url > http://repo1.maven.org/maven2/</url >
<releases >
<enabled > true</enabled >
</releases >
<snapshots >
<enabled > true</enabled >
</snapshots >
</repository >
<repository >
<id > egovframe</id >
<url > http://www.egovframe.go.kr/maven/</url >
<releases >
<enabled > true</enabled >
</releases >
<snapshots >
<enabled > false</enabled >
</snapshots >
</repository >
<repository >
<id > oracle</id >
<name > ORACLE JDBC Repository</name >
<url > http://mesir.googlecode.com/svn/trunk/mavenrepo</url >
</repository >
</repositories >
<dependencies >
<dependency >
<groupId > org.springframework</groupId >
<artifactId > spring-context</artifactId >
<version > ${org.springframework-version}</version >
<exclusions >
<exclusion >
<groupId > commons-logging</groupId >
<artifactId > commons-logging</artifactId >
</exclusion >
</exclusions >
</dependency >
<dependency >
<groupId > org.springframework</groupId >
<artifactId > spring-web</artifactId >
<version > ${org.springframework-version}</version >
</dependency >
<dependency >
<groupId > org.springframework</groupId >
<artifactId > spring-webmvc</artifactId >
<version > ${org.springframework-version}</version >
</dependency >
<dependency >
<groupId > org.springframework</groupId >
<artifactId > spring-aop</artifactId >
<version > ${org.springframework-version}</version >
</dependency >
<dependency >
<groupId > org.springframework</groupId >
<artifactId > spring-beans</artifactId >
<version > ${org.springframework-version}</version >
</dependency >
<dependency >
<groupId > org.springframework</groupId >
<artifactId > spring-context-support</artifactId >
<version > ${org.springframework-version}</version >
</dependency >
<dependency >
<groupId > org.springframework</groupId >
<artifactId > spring-core</artifactId >
<version > ${org.springframework-version}</version >
</dependency >
<dependency >
<groupId > org.springframework</groupId >
<artifactId > spring-jdbc</artifactId >
<version > ${org.springframework-version}</version >
</dependency >
<dependency >
<groupId > org.springframework</groupId >
<artifactId > spring-tx</artifactId >
<version > ${org.springframework-version}</version >
</dependency >
<dependency >
<groupId > aopalliance</groupId >
<artifactId > aopalliance</artifactId >
<version > 1.0</version >
</dependency >
<dependency >
<groupId > org.mybatis</groupId >
<artifactId > mybatis</artifactId >
<version > 3.2.2</version >
</dependency >
<dependency >
<groupId > org.mybatis</groupId >
<artifactId > mybatis-spring</artifactId >
<version > 1.2.0</version >
</dependency >
<dependency >
<groupId > org.apache.tomcat</groupId >
<artifactId > tomcat-dbcp</artifactId >
<scope > provided</scope >
<version > 7.0.53</version >
</dependency >
<dependency >
<groupId > commons-dbcp</groupId >
<artifactId > commons-dbcp</artifactId >
<version > 1.4</version >
</dependency >
<dependency >
<groupId > mysql</groupId >
<artifactId > mysql-connector-java</artifactId >
<version > 5.1.31</version >
</dependency >
<dependency >
<groupId > com.oracle</groupId >
<artifactId > ojdbc14</artifactId >
<version > 10.2.0.4.0</version >
</dependency >
<dependency >
<groupId > org.aspectj</groupId >
<artifactId > aspectjrt</artifactId >
<version > ${org.aspectj-version}</version >
</dependency >
<dependency >
<groupId > org.aspectj</groupId >
<artifactId > aspectjweaver</artifactId >
<version > ${org.aspectj-version}</version >
</dependency >
<dependency >
<groupId > org.aspectj</groupId >
<artifactId > aspectjtools</artifactId >
<version > ${org.aspectj-version}</version >
</dependency >
<dependency >
<groupId > javax.servlet</groupId >
<artifactId > javax.servlet-api</artifactId >
<version > 3.1.0</version >
<scope > provided</scope >
</dependency >
<dependency >
<groupId > javax.servlet.jsp</groupId >
<artifactId > jsp-api</artifactId >
<scope > provided</scope >
<version > 2.1</version >
</dependency >
<dependency >
<groupId > javax.servlet</groupId >
<artifactId > jstl</artifactId >
<version > 1.2</version >
</dependency >
<dependency >
<groupId > javax.annotation</groupId >
<artifactId > jsr250-api</artifactId >
<version > 1.0</version >
</dependency >
<dependency >
<groupId > org.slf4j</groupId >
<artifactId > slf4j-api</artifactId >
<version > ${org.slf4j-version}</version >
</dependency >
<dependency >
<groupId > org.slf4j</groupId >
<artifactId > jcl-over-slf4j</artifactId >
<version > ${org.slf4j-version}</version >
</dependency >
<dependency >
<groupId > org.slf4j</groupId >
<artifactId > slf4j-log4j12</artifactId >
<version > ${org.slf4j-version}</version >
</dependency >
<dependency >
<groupId > log4j</groupId >
<artifactId > log4j</artifactId >
<version > 1.3alpha-8</version >
</dependency >
<dependency >
<groupId > org.lazyluke</groupId >
<artifactId > log4jdbc-remix</artifactId >
<version > 0.2.7</version >
</dependency >
<dependency >
<groupId > com.fasterxml.jackson.core</groupId >
<artifactId > jackson-databind</artifactId >
<version > 2.5.1</version >
</dependency >
<dependency >
<groupId > com.fasterxml.jackson.core</groupId >
<artifactId > jackson-core</artifactId >
<version > 2.5.1</version >
</dependency >
<dependency >
<groupId > commons-io</groupId >
<artifactId > commons-io</artifactId >
<version > 2.0.1</version >
</dependency >
<dependency >
<groupId > commons-fileupload</groupId >
<artifactId > commons-fileupload</artifactId >
<version > 1.2.2</version >
</dependency >
<dependency >
<groupId > commons-codec</groupId >
<artifactId > commons-codec</artifactId >
<version > 1.10</version >
</dependency >
<dependency >
<groupId > egovframework.rte</groupId >
<artifactId > egovframework.rte.fdl.property</artifactId >
<version > 2.7.0</version >
</dependency >
<dependency >
<groupId > log4j</groupId >
<artifactId > log4j</artifactId >
<version > 1.2.15</version >
<exclusions >
<exclusion >
<groupId > javax.mail</groupId >
<artifactId > mail</artifactId >
</exclusion >
<exclusion >
<groupId > javax.jms</groupId >
<artifactId > jms</artifactId >
</exclusion >
<exclusion >
<groupId > com.sun.jdmk</groupId >
<artifactId > jmxtools</artifactId >
</exclusion >
<exclusion >
<groupId > com.sun.jmx</groupId >
<artifactId > jmxri</artifactId >
</exclusion >
</exclusions >
</dependency >
<dependency >
<groupId > javax.inject</groupId >
<artifactId > javax.inject</artifactId >
<version > 1</version >
</dependency >
<dependency >
<groupId > org.apache.maven.plugins</groupId >
<artifactId > maven-war-plugin</artifactId >
<version > 2.3</version >
</dependency >
<dependency >
<groupId > junit</groupId >
<artifactId > junit</artifactId >
<version > 4.7</version >
<scope > test</scope >
</dependency >
</dependencies >
<build >
<defaultGoal > install</defaultGoal >
<directory > ${basedir}/target</directory >
<finalName > first</finalName >
<plugins >
<plugin >
<artifactId > maven-eclipse-plugin</artifactId >
<version > 2.9</version >
<configuration >
<additionalProjectnatures >
<projectnature > org.springframework.ide.eclipse.core.springnature</projectnature >
</additionalProjectnatures >
<additionalBuildcommands >
<buildcommand > org.springframework.ide.eclipse.core.springbuilder</buildcommand >
</additionalBuildcommands >
<downloadSources > true</downloadSources >
<downloadJavadocs > true</downloadJavadocs >
</configuration >
</plugin >
<plugin >
<groupId > org.apache.maven.plugins</groupId >
<artifactId > maven-compiler-plugin</artifactId >
<version > 2.5.1</version >
<configuration >
<source > ${java-version}</source >
<target > ${java-version}</target >
<encoding > UTF-8</encoding >
<compilerArgument > -Xlint:all</compilerArgument >
<showWarnings > true</showWarnings >
<showDeprecation > true</showDeprecation >
</configuration >
</plugin >
<plugin >
<groupId > org.codehaus.mojo</groupId >
<artifactId > exec-maven-plugin</artifactId >
<version > 1.2.1</version >
<configuration >
<mainClass > org.test.int1.Main</mainClass >
</configuration >
</plugin >
<plugin >
<groupId > org.apache.maven.plugins</groupId >
<artifactId > maven-javadoc-plugin</artifactId >
<version > 2.5</version >
</plugin >
</plugins >
</build >
</project >
2. index.jsp 추가
2-1. webapp 폴더에 index.jsp 를 생성한다.
2-2. index.jsp 소스를 수정한다.
<body >
<h3 > index page</h3 >
</body >
2-3. web.xml 에서 index.jsp 설정을 추가한다.
<web-app version ="3.0" xmlns ="http://java.sun.com/xml/ns/javaee"
xmlns:xsi ="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation ="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" >
<welcome-file-list >
<welcome-file > index.jsp</welcome-file >
</welcome-file-list >
2-4. Server 실행후 http://localhost:8080/프로젝트이름/ 주소창에 입력한다.
3. Servlet 설정 변경
web.xml 파일을 열고
<servlet >
<servlet-name > appServlet</servlet-name >
<servlet-class > org.springframework.web.servlet.DispatcherServlet</servlet-class >
<init-param >
<param-name > contextConfigLocation</param-name >
<param-value > /WEB-INF/spring/appServlet/servlet-context.xml</param-value >
</init-param >
<load-on-startup > 1</load-on-startup >
</servlet >
<servlet-mapping >
<servlet-name > appServlet</servlet-name >
<url-pattern > /</url-pattern >
</servlet-mapping >
를 다음과 같이 변경한다.
<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/*-servlet.xml
</param-value >
</init-param >
<load-on-startup > 1</load-on-startup >
</servlet >
<servlet-mapping >
<servlet-name > action</servlet-name >
<url-pattern > *.do</url-pattern >
</servlet-mapping >
4. contextConfigLocation 변경
4-1. WEB-INF 폴더 밑에 config 폴더를 생성후 servlet-context.xml을 복사해서 action-servlet.xml 로 이름을 변경한다. spring 폴더는 삭제한다.
4-2. web.xml 소스를 수정한다.
<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/*-servlet.xml
</param-value >
</init-param >
<load-on-startup > 1</load-on-startup >
</servlet >
5. UTF-8 설정
web.xml에 추가한다.
<filter >
<filter-name > encodingFilter</filter-name >
<filter-class >
org.springframework.web.filter.CharacterEncodingFilter
</filter-class >
<init-param >
<param-name > encoding</param-name >
<param-value > utf-8</param-value >
</init-param >
</filter >
<filter-mapping >
<filter-name > encodingFilter</filter-name >
<url-pattern > *.do</url-pattern >
</filter-mapping >
6. 기타 설정
기존 contextConfigLocation 설정을 수정한다.
<context-param >
<param-name > contextConfigLocation</param-name >
<param-value > </param-value >
</context-param >
7. 최종 web.xml
<web-app version ="3.0" xmlns ="http://java.sun.com/xml/ns/javaee"
xmlns:xsi ="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation ="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" >
<welcome-file-list >
<welcome-file > index.jsp</welcome-file >
</welcome-file-list >
<context-param >
<param-name > contextConfigLocation</param-name >
<param-value > classpath*:config/spring/context-*.xml</param-value >
</context-param >
<listener >
<listener-class > org.springframework.web.context.ContextLoaderListener</listener-class >
</listener >
<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/*-servlet.xml
</param-value >
</init-param >
<load-on-startup > 1</load-on-startup >
</servlet >
<servlet-mapping >
<servlet-name > action</servlet-name >
<url-pattern > *.do</url-pattern >
</servlet-mapping >
<filter >
<filter-name > encodingFilter</filter-name >
<filter-class >
org.springframework.web.filter.CharacterEncodingFilter
</filter-class >
<init-param >
<param-name > encoding</param-name >
<param-value > utf-8</param-value >
</init-param >
</filter >
<filter-mapping >
<filter-name > encodingFilter</filter-name >
<url-pattern > *.do</url-pattern >
</filter-mapping >
</web-app >
0 개의 댓글:
댓글 쓰기