xml version="1.0" encoding="UTF-8"?>
<web-app 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_2_5.xsd"
version="2.5">
<context-param>
<param-name>contextConfigLocationparam-name>
<param-value>classpath:spring-config.xmlparam-value>
context-param>
<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
listener-class>
listener>
<filter>
<filter-name>struts2filter-name>
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilterfilter-class>
filter>
<filter-mapping>
<filter-name>struts2filter-name>
<url-pattern>/*url-pattern>
filter-mapping>
web-app>
spring-config.xml
xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
<bean id="propertyConfig" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<list>
<value>classpath:spring-jdbc.propertiesvalue>
list>
property>
bean>
<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName">
<value>${jdbc.driver}value>
property>
<property name="url">
<value>${jdbc.url}value>
property>
<property name="username">
<value>${jdbc.username}value>
property>
<property name="password">
<value>${jdbc.password}value>
property>
bean>

<bean id="sqlMapClient" class="org.springframework.orm.ibatis.SqlMapClientFactoryBean">
<property name="dataSource">
<ref local="dataSource"/>
property>
<property name="sqlMapClientProperties">
<props>
<prop key="jdbcDriver">${jdbc.driver}prop>
props>
property>
<property name="configLocation">
<value>classpath:SqlMapConfig.xmlvalue>
property>
bean>

<bean id="sqlMapClientTemplate" class="org.springframework.orm.ibatis.SqlMapClientTemplate">
<property name="sqlMapClient">
<ref bean="sqlMapClient"/>
property>
bean>

<bean id="addressDAO" class="cn.hhit.gwap.dao.ibatis.AddressDAOIbatis">
<property name="sqlMapClient">
<ref bean="sqlMapClient"/>
property>
bean>
<bean id="bookDAO" class="cn.hhit.gwap.dao.ibatis.BookDAOIbatis">
<property name="sqlMapClient">
<ref bean="sqlMapClient"/>
property>
bean>
<bean id="categoryDAO" class="cn.hhit.gwap.dao.ibatis.CategoryDAOIbatis">
<property name="sqlMapClient">
<ref bean="sqlMapClient"/>
property>
bean>
<bean id="itemDAO" class="cn.hhit.gwap.dao.ibatis.ItemDAOIbatis">
<property name="sqlMapClient">
<ref bean="sqlMapClient"/>
property>
bean>
<bean id="orderDAO" class="cn.hhit.gwap.dao.ibatis.OrderDAOIbatis">
<property name="sqlMapClient">
<ref bean="sqlMapClient"/>
property>
bean>
<bean id="productDAO" class="cn.hhit.gwap.dao.ibatis.ProductDAOIbatis">
<property name="sqlMapClient">
<ref bean="sqlMapClient"/>
property>
bean>
<bean id="userDAO" class="cn.hhit.gwap.dao.ibatis.UserDAOIbatis">
<property name="sqlMapClient">
<ref bean="sqlMapClient"/>
property>
bean>
<bean id="checkEmailAction" class="cn.hhit.gwap.action.user.CheckEmailAction" scope="prototype">
<property name="userDAO">
<ref bean="userDAO"/>
property>
bean>
<bean id="loginAction" class="cn.hhit.gwap.action.user.LoginAction" scope="prototype">
<property name="userDAO">
<ref bean="userDAO"/>
property>
bean>
<bean id="registAction" class="cn.hhit.gwap.action.user.RegistAction" scope="prototype">
<property name="userDAO">
<ref bean="userDAO"/>
property>
bean>
<bean id="imageAction" class="cn.hhit.gwap.action.user.ImageAction" scope="prototype">bean>
<bean id="varifyAction" class="cn.hhit.gwap.action.user.VarifyAction" scope="prototype">
<property name="userDAO">
<ref bean="userDAO"/>
property>
bean>
<bean id="bookDetailAction" class="cn.hhit.gwap.action.main.BookDetailAction" scope="prototype">
<property name="productDAO">
<ref bean="productDAO"/>
property>
<property name="bookDAO">
<ref bean="bookDAO"/>
property>
bean>
<bean id="bookListAction" class="cn.hhit.gwap.action.main.BookListAction" scope="prototype">
<property name="categoryDAO">
<ref bean="categoryDAO"/>
property>
bean>
<bean id="categoryAction" class="cn.hhit.gwap.action.main.CategoryAction" scope="prototype">
<property name="categoryDAO">
<ref bean="categoryDAO"/>
property>
bean>
<bean id="logoutAction" class="cn.hhit.gwap.action.main.LogoutAction" scope="prototype">bean>
<bean id="shoppingAction" class="cn.hhit.gwap.action.main.ShoppingAction" scope="prototype">
<property name="productDAO">
<ref bean="productDAO"/>
property>
bean>
<bean id="addrAction" class="cn.hhit.gwap.action.order.AddrAction" scope="prototype">
<property name="addressDAO">
<ref bean="addressDAO"/>
property>
<property name="itemDAO">
<ref bean="itemDAO"/>
property>
<property name="orderDAO">
<ref bean="orderDAO"/>
property>
bean>
<bean id="orderAction" class="cn.hhit.gwap.action.order.OrderAction" scope="prototype">
<property name="addressDAO">
<ref bean="addressDAO"/>
property>
bean>
<bean id="orderItemViewAction" class="cn.hhit.gwap.action.order.OrderItemViewAction" scope="prototype">
<property name="itemDAO">
<ref bean="itemDAO"/>
property>
bean>
<bean id="orderViewAction" class="cn.hhit.gwap.action.order.OrderViewAction" scope="prototype">
<property name="orderDAO">
<ref bean="orderDAO"/>
property>
bean>
<bean id="showCartAction" class="cn.hhit.gwap.action.cart.ShowCartAction" scope="prototype">bean>
beans>
spring-jdbc.properties
jdbc.driver=com.mysql.jdbc.Driver
jdbc.url=jdbc:mysql://127.0.0.1:3306/gwap
jdbc.username=root
jdbc.password=123456
struts.xml
xml version="1.0" encoding="UTF-8"?>
DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.1//EN"
"http://struts.apache.org/dtds/struts-2.1.dtd">
<struts>
<include file="struts-main.xml" />
<include file="struts-user.xml" />
<include file="struts-order.xml" />
<include file="struts-cart.xml" />
<package name="gwap-default" extends="json-default">
<global-results>
<result>/WEB-INF/jsp/fail.jspresult>
global-results>
package>
struts>
struts-main.xml
xml version="1.0" encoding="UTF-8" ?>
DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.1.7//EN"
"http://struts.apache.org/dtds/struts-2.1.7.dtd">
<struts>
<package name="dang-main" namespace="/main" extends="gwap-default">
<action name="index">
<result>/WEB-INF/jsp/main/main.jspresult>
action>
<action name="login">
<result type="redirectAction">
<param name="actionName">indexparam>
<param name="namespace">/userparam>
result>
action>
<action name="logout" class="logoutAction">
<result name="success">/WEB-INF/jsp/main/main.jspresult>
<result name="next" type="json">result>
action>
<action name="detail" class="bookDetailAction">
<result name="success">/WEB-INF/jsp/main/book_detail.jspresult>
action>
<action name="category" class="categoryAction">
<result name="success">/WEB-INF/jsp/main/category.jspresult>
action>
<action name="booklist" class="bookListAction">
<param name="size">5param>
<result name="success">/WEB-INF/jsp/main/book_list.jspresult>
action>
<action name="shopping" class="shoppingAction">
<result type="json">result>
action>
package>
struts>