Web.xml
struts-config.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>shop9</display-name>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:beans.xml</param-value>
</context-param>
<!-- 对Spring容器进行实例化 -->
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<listener>
<listener-class>com.itcast.web.action.shopping.SiteSessionListener</listener-class>
</listener>
<filter>
<filter-name>Spring OpenEntityManagerInViewFilter</filter-name>
<filter-class>org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>Spring OpenEntityManagerInViewFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter>
<filter-name>codeFilter</filter-name>
<filter-class>com.itcast.web.filter.SetCodeFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>codeFilter</filter-name>
<url-pattern>*.do</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>codeFilter</filter-name>
<url-pattern>*.jsp</url-pattern>
</filter-mapping>
<servlet>
<servlet-name>struts</servlet-name>
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>struts</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>
struts-config.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts-config PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 1.3//EN"
"http://struts.apache.org/dtds/struts-config_1_3.dtd">
<struts-config>
<form-beans>
<form-bean name="producttypeform" type="com.itcast.web.formbean.product.ProductTypeForm"/>
<form-bean name="brandform" type="com.itcast.web.formbean.product.BrandForm"/>
<form-bean name="uploadfileform" type="com.itcast.web.formbean.uploadfile.UploadfileForm"/>
<form-bean name="productform" type="com.itcast.web.formbean.product.ProductForm"/>
<form-bean name="frontProductForm" type="com.itcast.web.formbean.product.FrontProductForm"/>
<form-bean name="cartForm" type="com.itcast.web.formbean.product.CartForm"/>
<form-bean name="departmentform" type="com.itcast.web.formbean.privilege.DepartmentForm"/>
<form-bean name="employeeForm" type="com.itcast.web.formbean.privilege.EmployeeForm"/>
<form-bean name="privilegeGroupForm" type="com.itcast.web.formbean.privilege.PrivilegeGroupForm"/>
</form-beans>
<global-forwards>
<forward name="message" path="/WEB-INF/page/share/message.jsp" />
</global-forwards>
<action-mappings>
<!-- 系统初始化 -->
<action path="/system/init"/>
<action path="/control/center/main" forward="/WEB-INF/page/controlcenter/default.jsp"/>
<action path="/control/center/top" forward="/WEB-INF/page/controlcenter/top.jsp"/>
<action path="/control/center/left" forward="/WEB-INF/page/controlcenter/menu.jsp"/>
<action path="/control/center/right" forward="/WEB-INF/page/controlcenter/right.jsp"/>
<action path="/control/center/end" forward="/WEB-INF/page/controlcenter/end.jsp"/>
<!-- 产品类别分页显示 -->
<action path="/control/product/type/list" name="producttypeform" scope="request">
<forward name="list" path="/WEB-INF/page/product/producttypelist.jsp"/>
</action>
<!-- 产品类别管理 -->
<action path="/control/product/type/manage" name="producttypeform" scope="request" parameter="method">
<forward name="add" path="/WEB-INF/page/product/add_productType.jsp"/>
<forward name="edit" path="/WEB-INF/page/product/edit_productType.jsp"/>
<forward name="query" path="/WEB-INF/page/product/query_productType.jsp"/>
</action>
<!-- 产品品牌分页显示 -->
<action path="/control/brand/list" name="brandform" scope="request">
<forward name="list" path="/WEB-INF/page/product/brandlist.jsp"/>
</action>
<!-- 产品产品管理 -->
<action path="/control/brand/manage" name="brandform" scope="request" parameter="method">
<forward name="add" path="/WEB-INF/page/product/add_brand.jsp"/>
<forward name="edit" path="/WEB-INF/page/product/edit_brand.jsp"/>
<forward name="query" path="/WEB-INF/page/product/query_brand.jsp"/>
</action>
<!-- 上传文件管理 -->
<action path="/control/uploadfile/manage" name="uploadfileform" scope="request" parameter="method">
<forward name="upload" path="/WEB-INF/page/uploadfile/upload.jsp"/>
<forward name="uploadfinish" path="/WEB-INF/page/uploadfile/fileuploadfinish.jsp"/>
<forward name="error" path="/WEB-INF/page/uploadfile/error.jsp"/>
</action>
<!-- 上传文件分页显示 -->
<action path="/control/uploadfile/list" name="uploadfileform" scope="request">
<forward name="list" path="/WEB-INF/page/uploadfile/uploadfilelist.jsp"/>
</action>
<!-- 产品分页显示 -->
<action path="/control/product/list" name="productform" scope="request">
<forward name="list" path="/WEB-INF/page/product/productlist.jsp"/>
</action>
<!-- 产品管理 -->
<action path="/control/product/manage" name="productform" scope="request" parameter="method">
<forward name="add" path="/WEB-INF/page/product/add_product.jsp"/>
<forward name="edit" path="/WEB-INF/page/product/edit_product.jsp"/>
<forward name="typeselect" path="/WEB-INF/page/product/productTypeSelect.jsp"/>
<forward name="query" path="/WEB-INF/page/product/query_product.jsp"/>
</action>
<!-- 产品样式显示 -->
<action path="/control/product/style/list" name="productform" scope="request">
<forward name="list" path="/WEB-INF/page/product/productstylelist.jsp"/>
</action>
<!-- 产品样式管理 -->
<action path="/control/product/style/manage" name="productform" scope="request" parameter="method">
<forward name="add" path="/WEB-INF/page/product/add_productstyle.jsp"/>
<forward name="edit" path="/WEB-INF/page/product/edit_productstyle.jsp"/>
</action>
<!-- 部门分页显示 -->
<action path="/control/department/list" name="departmentform" scope="request">
<forward name="list" path="/WEB-INF/page/department/departmentlist.jsp"/>
</action>
<!-- 部门管理 -->
<action path="/control/department/manage" name="departmentform" scope="request" parameter="method">
<forward name="add" path="/WEB-INF/page/department/adddepartment.jsp"/>
<forward name="edit" path="/WEB-INF/page/department/editdepartment.jsp"/>
</action>
<!-- 员工分页显示 -->
<action path="/control/employee/list" name="employeeForm" scope="request">
<forward name="list" path="/WEB-INF/page/department/employeelist.jsp"/>
</action>
<!-- 员工管理 -->
<action path="/control/employee/manage" name="employeeForm" scope="request" parameter="method">
<forward name="add" path="/WEB-INF/page/department/addemployee.jsp"/>
<forward name="edit" path="/WEB-INF/page/department/editemployee.jsp"/>
<forward name="usernameIsExsit" path="/WEB-INF/page/department/usernameIsExsit.jsp"/>
</action>
<!-- 权限组分页显示 -->
<action path="/control/privilegegroup/list" name="privilegeGroupForm" scope="request">
<forward name="list" path="/WEB-INF/page/department/privilegegrouplist.jsp"/>
</action>
<!-- 权限组管理 -->
<action path="/control/privilegegroup/manage" name="privilegeGroupForm" scope="request" parameter="method">
<forward name="add" path="/WEB-INF/page/department/addprivilegegroup.jsp"/>
<forward name="edit" path="/WEB-INF/page/department/editprivilegegroup.jsp"/>
</action>
<!-- #####################################前台显示######################################## -->
<!-- 产品列表显示 -->
<action path="/product/list" name="frontProductForm" scope="request">
<forward name="list_image" path="/WEB-INF/page/product/frontpage/productlist.jsp"/>
<forward name="list_imagetext" path="/WEB-INF/page/product/frontpage/productlist_text.jsp"/>
</action>
<!-- 产品样式管理 -->
<action path="/product/switch" name="frontProductForm" scope="request" parameter="method">
<forward name="topsell" path="/WEB-INF/page/product/frontpage/topsell.jsp"/>
<forward name="viewHistory" path="/WEB-INF/page/product/frontpage/viewHistory.jsp"/>
<forward name="showimage" path="/WEB-INF/page/product/frontpage/showimage.jsp"/>
</action>
<!-- 产品显示 -->
<action path="/product/view" name="frontProductForm" scope="request">
<forward name="product" path="/WEB-INF/page/product/frontpage/productview.jsp"/>
</action>
<!-- 购物车 -->
<action path="/shopping/cart" name="cartForm" scope="request">
<forward name="cart" path="/WEB-INF/page/shopping/cart.jsp"/>
</action>
<!-- 购物管理 -->
<action path="/shopping/cart/manage" name="cartForm" scope="request" parameter="method">
<forward name="result" redirect="true" path="/shopping/cart.do"/>
</action>
</action-mappings>
<controller>
<set-property property="processorClass" value="org.springframework.web.struts.DelegatingRequestProcessor"/>
</controller>
</struts-config>