面试题

来源:互联网 发布:怎么抢淘宝秒杀的东西 编辑:程序博客网 时间:2024/06/05 20:45

Struts1

的工作原理

 

 

1)

 

客户端浏览器向

Servlet

容器(如

Tomcat

)提交一个请求到

ActionServlet 

2)

 

ActionServlet

对请求进行一系列处理,

然后根据请求的路径和配置信息找到对应的

Action

ActionForm

并将请求中包含的数据填充到

ActionForm

中(如果

Action

有绑定

Form

,那么不进行数据填充)

 

3)

 

Struts

将请求分发至相应的

Action

处理,

ActionMapping

对象、

ActionForm

对象、

request

response

都将作为参数传给处理请求的

Action

execute

方法

 

4)

 

Action

调用业务逻辑方法,得到返回值,并返回

ActionForward

对象

 

5)

 

控制权重新回到

ActionServlet

ActionServlet

根据

Action

返回的

ActionForward

对象

转发到相应的页面

 

6)

 

处理结果返回到客户端浏览器

原创粉丝点击