ssh执行流程

<!-- /* Font Definitions */ @font-face {font-family:宋体; panose-1:2 1 6 0 3 1 1 1 1 1; mso-font-alt:SimSun; mso-font-charset:134; mso-generic-font-family:auto; mso-font-pitch:variable; mso-font-signature:3 135135232 16 0 262145 0;} @font-face {font-family:"/@宋体"; panose-1:2 1 6 0 3 1 1 1 1 1; mso-font-charset:134; mso-generic-font-family:auto; mso-font-pitch:variable; mso-font-signature:3 135135232 16 0 262145 0;} /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {mso-style-parent:""; margin:0cm; margin-bottom:.0001pt; text-align:justify; text-justify:inter-ideograph; mso-pagination:none; font-size:10.5pt; mso-bidi-font-size:12.0pt; font-family:"Times New Roman"; mso-fareast-font-family:宋体; mso-font-kerning:1.0pt;} p {mso-margin-top-alt:auto; margin-right:0cm; mso-margin-bottom-alt:auto; margin-left:0cm; mso-pagination:widow-orphan; font-size:12.0pt; font-family:宋体; mso-bidi-font-family:宋体;} /* Page Definitions */ @page {mso-page-border-surround-header:no; mso-page-border-surround-footer:no;} @page Section1 {size:612.0pt 792.0pt; margin:72.0pt 90.0pt 72.0pt 90.0pt; mso-header-margin:36.0pt; mso-footer-margin:36.0pt; mso-paper-source:0;} div.Section1 {page:Section1;} -->

1. 从页面开始,工资管理触发一个action(salary!init.action: 为多分支actionaction 名为salary, 执行的方法为init() 方法)

2.action 交给struts2 处理,读取src 目录struts.xml 文件,其中有个配置salaryaction, 如下所示:

<action name="salary" class="salaryAction">

<result name="list">/admin/salary_page.jsp</result>

</action>

3. 根据class="salaryAction" 交给Spring( 为什么strutsaction 会交给spring 处理呢?原因是:Struts2 提供一个jar

struts2-spring-plugin-2.1.2.jar ,有个struts.properties 文件,打开查找,输入auto 查找有这样一段话:

### specifies the autoWiring logic when using the SpringObjectFactory.

### valid values are: name, type, auto, and constructor (name is the default)

struts.objectFactory.spring.autoWire = name 。也就是有了上面那个jar 包之后,根据name 自动提交给Spring 处理)

读取Spring 容器的配置文件/WebRoot/WEB-INF/applicationContext.xml 文件。

<bean name="salaryAction" class="com.bu3g.ssh.web.action.SalaryAction">

<property name="empService">

<ref local="empService" />

</property>

</bean>

根据applicationContext.xml 配置文件找到com.bu3g.ssh.web.action.SalaryAction 类,其中有一个属性empService, 并提供了

setEmpService() 方法,由applicationContext.xml 文件得知该empService 对象由Spring 容器依赖注入,set 注入。

<ref local="empService" /> 这个可以知道SalaryAction 的属性empService 引用了本地的(即applicationContext.xml 文件中

配置的一个bean

<bean id="empService"

class="com.bu3g.ssh.service.impl.EmployeeServiceImpl">

<property name="empDAO" ref="empDAO" />

<property name="payDAO" ref="payDAO" />

</bean>

4. 取得empService 对象( 接口对接口实现类的一个引用) 后,调用它的getPager 方法。后面的就是访问DAO 了,一长串省略号代替。。。。。。。。。。。。。。

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值