Struts2框架主要分为3部分:
–核心控制器FilterDispatcher
–业务控制器Action
–用户实现的企业业务逻辑组件

Struts2工作流程:

struts2入门--工作流程
基本简要流程:

1、客户端浏览器发出HTTP请求。

2、根据web.xml配置,该请求被FilterDispatcher接收。

3、根据struts.xml配置,找到需要调用的Action类和方法, 并通过IoC方式,将值注入给Aciton。

4、Action调用业务逻辑组件处理业务逻辑,这一步包含表单验证。

5、Action执行完毕,根据struts.xml中的配置找到对应的返回结果result,并跳转到相应页面。

6、返回HTTP响应到客户端浏览器。

常用的struts2配置文件:
–web.xml
–struts.xml
–struts-config.xml
–struts.properties
其中用web.xml和struts.xml较为常见

配置struts2环境:
struts2入门--工作流程

各个jar包功能:
–struts2-core.jar 核心jar包
–xwork-2.jar xwork核心jar包
–ognl.jar ognl表达式
–freemarker.jar FreeMarker模板
–commons-logging.jar 日志
–commons-fileupload.jar 文件上传
–commons-io.jar 文件上传依赖的包

相关文章:

  • 2021-07-04
  • 2021-10-10
  • 2021-09-16
  • 2021-09-01
  • 2022-02-26
  • 2021-04-19
猜你喜欢
  • 2022-02-09
  • 2022-02-25
  • 2022-02-15
  • 2021-10-26
  • 2021-11-09
  • 2021-09-24
相关资源
相似解决方案