该层的测试,需要将ssh_dao中的applicationContext-dao.xml将ssh_service的applicationContext-service.xml包含进去才能够实验的通。这里不做测试,
2.4、创建ssh_web子模块
方法同maven-dao模块创建方法,模块名称为ssh-web,注意:打包方式为war,而不再是jar包了,因为该层需要放到tomcat中去。与浏览器交互,就是web项目了,所以打成war包
和前面一样,ssh_parent的pom.xml中增加一个module结点,而ssh_web的pom.xml中增加一个parent结点
这个也很简单,就是跟写普通的struts2是一样的,只不过是和spring的结合,有什么对象,都通过spring来给予,并且这里多做一个事情,就是将之前的applicationContext配置文件进行结合,看下图

<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p" xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:aop="http://www.springframework.org/schema/aop" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd"> <import resource="classpath:applicationContext-dao"/> <import resource="classpath:applicationContext-service"/> <import resource="classpath:applicationContext-web"/> </beans>
本文来自电脑杂谈,转载请注明本文网址:
http://www.pc-fly.com/a/jisuanjixue/article-60366-4.html
但北洋水师主力舰占优
你怎么像人呢