게시판 프로젝트 환경설정하기
<web.xml> 설정하기...
======================================================================
<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<display-name>springBoard</display-name>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/ApplicationContext.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<servlet>
<servlet-name>springapp</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>springapp</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>EUC-KR</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>encodingFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<welcome-file-list>
<welcome-file>
index.jsp
</welcome-file>
</welcome-file-list>
</web-app>
ApplicationContext.xml 설정하기
데이터 소스 설정 및 sqlMapclient 설정하기
======================================================================
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<bean id="dataSource"
class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName"
value="oracle.jdbc.driver.OracleDriver" />
<property name="url"
value="jdbc:oracle:thin:@192.168.1.100:1521:ORCL" />
<property name="username" value="scott" />
<property name="password" value="tiger" />
</bean>
<bean id="sqlMapClient"
class="org.springframework.orm.ibatis.SqlMapClientFactoryBean">
<property name="configLocation"
value="WEB-INF/sqlMapConfig.xml" />
<property name="dataSource" ref="dataSource" />
</bean>
<bean id="boardTooltipDao" class="boardDao.BoardTooltipDaoImpl">
<property name="sqlMapClient">
<ref bean="sqlMapClient"/>
</property>
</bean>
<bean id="boardListDao" class="boardDao.BoardListDaoImpl">
<property name="sqlMapClient">
<ref bean="sqlMapClient" />
</property>
</bean>
<bean id ="boardDownDao" class="boardDao.BoardDownDaoImpl">
<property name="sqlMapClient">
<ref bean="sqlMapClient" />
</property>
</bean>
<bean id="boardContentDao" class="boardDao.BoardContentDaoImpl">
<property name="sqlMapClient">
<ref bean="sqlMapClient" />
</property>
</bean>
<bean id="boardWriteDao" class="boardDao.BoardWriteDaoImpl">
<property name="sqlMapClient">
<ref bean="sqlMapClient" />
</property>
</bean>
<bean id="boardUpdateDao" class="boardDao.BoardUpdateDaoImpl">
<property name="sqlMapClient">
<ref bean="sqlMapClient" />
</property>
</bean>
<bean id="boardDeleteDao" class="boardDao.BoardDeleteDaoImpl">
<property name="sqlMapClient">
<ref bean="sqlMapClient" />
</property>
</bean>
<bean id="boardCommentDao" class="boardDao.BoardCommentDaoImpl">
<property name="sqlMapClient">
<ref bean="sqlMapClient" />
</property>
</bean>
</beans>
springapp-servlet.xml 서블릿 설정 파일
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<bean id="springboardListController" class="web.SpringboardListController">
<property name="boardListDao" ref="boardListDao">
</property>
</bean>
<bean id="springBoardSimpleController" class="web.SpringrewriteFormController">
<property name="boardWriteDao" ref="boardWriteDao" />
<property name="boardUpdateDao" ref="boardUpdateDao" />
<property name="boardDeleteDao" ref="boardDeleteDao" />
<property name="boardCommentDao" ref="boardCommentDao" />
<!-- <property name="commandClass" value="board.Board" /> -->
<property name="sessionForm" value="true"/> <!-- 설정해야 세션에 커맨ㄷ 객체가 저장된다. -->
<property name="formView" value="writeForm"/>
<property name="successView" value="redirect:/boardList.do"/>
</bean>
<bean id="springBoardDownController" class="web.SpringBoardDownController">
<property name="boardDownDao" ref="boardDownDao"></property>
</bean>
<bean id="springBoardContentController" class="web.SpringBoardContentController">
<property name="boardContentDao" ref="boardContentDao" />
<property name="boardCommentDao" ref="boardCommentDao" />
</bean>
<bean id="springBoardTooltipController" class="web.SpringBoardTooltipController" >
<property name="boardTooltipDao" ref="boardTooltipDao" />
</bean>
<bean id="messageSource"
class="org.springframework.context.support.ResourceBundleMessageSource">
<property name="basename">
<value>messages</value>
</property>
</bean>
<bean id="urlMapping"
class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
<property name="mappings">
<props>
<prop key="/boardList.do">springboardListController</prop>
<prop key="/writePro.do">springBoardSimpleController</prop>
<prop key="/writeForm.do">springBoardSimpleController</prop>
<prop key="/content.do">springBoardContentController</prop>
<prop key="/updateForm.do">springBoardSimpleController</prop>
<prop key="/deleteForm.do">springBoardSimpleController</prop>
<prop key="/updatePro.do">springBoardSimpleController</prop>
<prop key="/deletePro.do">springBoardSimpleController</prop>
<prop key="/comment.do">springBoardSimpleController</prop>
<prop key="/tooltip.do">springBoardTooltipController</prop>
<prop key="/board_down.do">springBoardDownController</prop>
</props>
</property>
</bean>
<bean id="multipartResolver"
class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
<property name="maxUploadSize" value="100000000" />
<property name="uploadTempDir" ref="uploadDirResource" />
</bean>
<bean id="uploadDirResource"
class="org.springframework.core.io.FileSystemResource">
<constructor-arg>
<value>C:\upload\temp</value>
</constructor-arg>
</bean>
<bean id="viewResolver"
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="viewClass">
<value>org.springframework.web.servlet.view.JstlView</value>
</property>
<property name="prefix">
<value>/WEB-INF/jsp/</value>
</property>
<property name="suffix">
<value>.jsp</value>
</property>
</bean>
</beans>
sqlMapConfig.xml sqlMap 리소스 설정하기
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE sqlMapConfig PUBLIC "-//ibatis.apache.org//DTD SQL Map Config 2.0//EN" "http://ibatis.apache.org/dtd/sql-map-config-2.dtd">
<sqlMapConfig>
<settings
lazyLoadingEnabled="true"
cacheModelsEnabled="true"
enhancementEnabled="true"
maxRequests="512"
maxSessions="128"
maxTransactions="32"
/>
<sqlMap resource="boardDao/sqlmap-springibatis-list.xml" />
<sqlMap resource="boardDao/sqlmap-springibatis-write.xml"/>
<sqlMap resource="boardDao/sqlmap-springibatis-content.xml"/>
<sqlMap resource="boardDao/sqlmap-springibatis-update.xml" />
<sqlMap resource="boardDao/sqlmap-springibatis-delete.xml" />
<sqlMap resource="boardDao/sqlmap-springibatis-comment.xml" />
<sqlMap resource="boardDao/sqlmap-springibatis-tooltip.xml" />
</sqlMapConfig>
댓글 없음:
댓글 쓰기