lib에는 총 22개의 jar파일이 들어가 있어야 한다.
struts2에서 web구동에 필요한 파일 + ibatis + log4j + ojbdc +jstl
- com.util(FileManager.java, MyUtil.java)
- com.util.dao(CommonDAO.java, CommonDAOImpl.java)
- com.util.sqlMap(SqlMapConfig.java, sqlMapConfig.xml, temp_sqlMap.xml)
- log4j.properties -> src폴더에 옮겨놓기
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd" id="WebApp_ID" version="4.0">
<display-name>struts2</display-name>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
<!-- Struts2 환경 셋팅 -->
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
</web-app>
classes
폴더 만들기struts.i18n.encoding=UTF-8
struts.action.extention=action
struts.multipart.saveDir=c:\\temp
struts.configuration.files=struts-default.xml,struts.xml
struts.i18n.encoding=UTF-8
: struts의 한글 인코딩 설정을 해주는 것struts.action.extention=action
: .action
의 주소가 오struts.multipart.saveDir=c:\\temp
: struts.configuration.files=struts-default.xml,struts.xml
: struts-default.xml파일을 읽은 다음에 struts.xml(내가 생성한 파일)을 읽어들인다.<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts
PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
<package name="" extends="struts-default" namespace="">
<global-results>
<result name="error">/exception/error.jsp</result>
</global-results>
</package>
<include file="struts-test.xml"/>
<include file="struts-board.xml"/>
</struts>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts
PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
<package name="" extends="struts-default" namespace="">
</package>
</struts>
이렇게 하면 struts2를 사용할 수 있는 기본 세팅은 끝~!