创建一个新应用的配置步骤

在web.xml中增加相应模块的struts配置文件,例如:
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml,
/WEB-INF/modules/struts-config-shop.xml,
/WEB-INF/modules/struts-config-admin.xml
</param-value>
</init-param>
在action-servlet.xml中增加相应模块的spring配置文件,例如:
<beans default-autowire="byName" default-lazy-init="true">
<!-- 按模块导入实际的servlet-->
<import resource="modules/spring-config-shop.xml"/>
<import resource="modules/spring-config-admin.xml"/>
</beans>
修改struts配置文件,例如:
<form-beans>
<form-bean name="userinforForm" type="org.apache.struts.validator.LazyValidatorForm"/>
</form-beans>
<action-mappings>
<!--使用通配符,对/visa/进行批量配置-->
<action path="/admin/*" name="{1}Form" scope="request" validate="false" parameter="method">
<forward name="list" path="/WEB-INF/pages/admin/{1}List.jsp"/>
<forward name="edit" path="/WEB-INF/pages/admin/{1}Form.jsp"/>
<forward name="view" path="/WEB-INF/pages/admin/{1}View.jsp"/>
<forward name="success" redirect="true" path="/admin/{1}.do?method=list"/>
</action>
</action-mappings>
修改spring配置文件,例如:
<beans default-autowire="byName" default-lazy-init="true">
<bean name="/admin/userinfor" class="com.myss.admin.web.UserinforAction"/>
</beans>
修改src/resources/spring/serviceContext.xml文件,例如:
<beans default-lazy-init="true" default-autowire="byName">
<bean id="userinforManager" class="com.myss.admin.service.UserinforManager"/>
</beans>
修改src/resources/config/hibernate.cfg.xml文件,例如:
<hibernate-configuration>
<session-factory>
<mapping class="com.myss.admin.model.Userinfor"/>
</session-factory>
</hibernate-configuration>

你可能感兴趣的:(spring,Web,xml,Hibernate,struts)