From a high level, Struts2 is a pull-MVC (or MVC2) framework. The Model-View-Controller pattern in Struts2 is realized with following five core components:

  • Actions
  • Interceptors
  • Value Stack / OGNL
  • Results / Result types
  • View technologies

Struts 2 is slightly different from a traditional MVC framework in that the action takes the role of the model rather than the controller, although there is some overlap.

The above diagram depicts the Model, View and Controller to the Struts2 high level architecture. The controller is implemented with a Struts2 dispatch servlet filter as well as interceptors, the model is implemented with actions, and the view as a combination of result types and results. The value stack and OGNL provide common thread, linking and enabling integration between the other components.

Apart from the above components, there will be a lot of information that relates to configuration. Configuration for the web application, as well as configuration for actions, interceptors, results, etc.

This is the architectural overview of the Struts 2 MVC pattern. We will go through each component in more detail in the subsequent chapters.

Request life cycle

Based on the above digram, one can explain the user's request life cycle in Struts 2 as follows:

  • User sends a request to the server for requesting for some resource (i.e pages).
  • The FilterDispatcher looks at the request and then determines the appropriate Action.
  • Configured interceptors functionalities applies such as validation, file upload etc.
  • Selected action is executed to perform the requested operation.
  • Again, configured interceptors are applied to do any post-processing if required.
  • Finally the result is prepared by the view and returns the result to the user.

Struts 2 - Architecture的更多相关文章

  1. Struts 2 - Hello World Example

    As you learnt from the Struts 2 architecture, when you click on a hyperlink or submit an HTML form i ...

  2. Struts 2 Tutorial Basic MVC Architecture

    Model View Controller or MVC as it is popularly called, is a software design pattern for developing ...

  3. Struts和SpringMVC两种MVC框架比较

    基于Web的MVC framework在J2EE的世界内已是空前繁荣.TTS网站上几乎每隔一两个星期就会有新的MVC框架发布.目前比较好的MVC,老牌的有Struts.Webwork.新兴的MVC框架 ...

  4. 重读《Struts In Action》

    Figure   1.1. The Java Servlet API exposes the HTTP client/server protocol to the Java   platform. S ...

  5. spring3+struts2+hibernate3整合出现的问题,No mapping found for dependency [type=java.lang.String, name='struts.objectFactory.spring.enableAopSupport']

    七月 11, 2016 3:49:24 下午 org.apache.tomcat.util.digester.SetPropertiesRule begin警告: [SetPropertiesRule ...

  6. Struts2的一个问题: 找不到struts.xml的路径问题

    一. 最近在学习Struts2的一些知识,在使用Struts2搭建框架的时候,部署到服务器上的时候出现上面的问题: 三月 19, 2016 1:43:24 下午 org.apache.tomcat.u ...

  7. struts体系结构

    问题:   为什么 invoke()方法,一旦执行,表示action方法执行完毕,jsp页面已经处理完毕: 其返回值再修改无意义,不影响结果?? 解释: 着重看如下颜色的字: ■ ■ 官方文档有明确的 ...

  8. struts原理图

    n the diagram, an initial request goes to the Servlet container (such as Jetty or Resin) which is pa ...

  9. Struts 2 Overview

    Struts2 is popular and mature web application framework based on the MVC design pattern. Struts2 is ...

随机推荐

  1. struts的namespace理解

    转载: namespace决定了action的访问路径,默认为"",可以接受所有路径的action namespace可以写为/,或者/xxx,或者/xxx/yyy,对应的acti ...

  2. sqlalchemy常用语法

    一.新增数据 # 新增一条数据 user_obj = User(name="bigberg", passwd="twgdh123") Session.add(u ...

  3. 关于RESTful的理解

    如何更好的理解RESTful? (转自https://sanwen8.cn/p/54czrEO.html) 在测试开发中,我们经常接触到API,在调用API时候特别是第三方API时候,我们常常陷入以下 ...

  4. GO_08:GO语言基础之interface

    接口interface 1. 接口是一个或多个方法签名的集合 2. 只要某个类型拥有该接口的所有方法签名,即算实现该接口,无需显示声明实现了哪个接口,这称为 Structural typing 3. ...

  5. 京东全链路压测军演系统(ForceBot)架构解密

    摘要:全链路压测是应对电商大促容量规划最有效的手段,如何有效进行容量规划是其中的架构关键问题.京东在全链路压测方面做过多年尝试,本文转载京东商城基础平台技术专家文章,介绍其最新的自动化压测 Force ...

  6. 六、Kafka 用户日志上报实时统计之分析与设计

    一.项目整体概述 简述项目的背景 背景:用户行迹企业运营 分析项目的目的 通过对项目的分析,可以初步得到以下目的: •实时掌握用户动态 •根据实时统计结果,适度推广 •统计分析效果,快速合理的调整 二 ...

  7. 图片截取插件Cropper

    自己仿照github上的例子写的demo,github上的例子太抽象了,自己写的最适合自己,通俗易懂. <!DOCTYPE html> <html> <head> ...

  8. python概念-常用模块之究竟你是什么鬼

    模块: 一个模块就是一个包含了python定义和声明的文件,文件名就是模块名字加上.py的后缀. 说白了,就是一个python文件中定义好了类和方法,实现了一些功能,可以被别的python文件所调用 ...

  9. PHP在Linux下Apache环境中执行exec,system,passthru等服务器命令函数

    更多内容推荐微信公众号,欢迎关注: 若在服务器中使用php test.php运行exec,system,passthru等命令相关的脚本能成功运行,在web页面却没反应, [可能是服务器端,PHP脚本 ...

  10. xampp + windows 配置 memcache流程

    1.运行xampp服务,打开phpinfo查看信息,如下图: 从上到下,依次为 PHP版本:5.6: architecture:x86: TS:线程安全: vc11 2.牢记以上几个横线内容之后去下载 ...