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)
?
处理结果返回到客户端浏览器