struts2流程详解

 时间:2026-02-13 11:34:31

1、1.新建struts2Test web Project

struts2流程详解

2、2.把struts2的核心jar包拷贝进去

struts2流程详解

3、3.在web.xml中配置struts2的过滤器 filter

/*标示拦截所有URL 交给struts2的过滤器来进行处理

struts2流程详解

4、4.新建struts.xml 配置文件

测试的HelloStruts2Action 类

以及最终跳转的页面helloWorld.jsp

struts2流程详解

5、5.在struts.xml中 新建test空间,并配置第一个action test1

此处代码表示访问test1 的时候进入HelloStruts2Action 类 处理后 跳转到helloWorld.jsp 页面

struts2流程详解

6、6.HelloStruts2Action 类 需要继承 ActionSupport  , 由于struts.xml中没有指定特定的method方法,则进入默认的execute方法进行执行

struts2流程详解

7、7.页面当中只有一句话

struts2流程详解

8、8.当访问localhost:8080/struts2Test/test1/ 的时候,首先会被web.xml中的过滤器过滤 交给struts2来处理,进入struts.xml中找到 “/”命名空间 再找到对应的test1 ,进入HelloStruts2Action 类 处理后 跳转到helloWorld.jsp 页面

struts2流程详解

  • struts2拦截器流程详解
  • struts2如何下载?
  • 如何下载struts2框架
  • struts2与spring如何整合
  • struts2获取request三种方法
  • 热门搜索
    豆渣怎么吃 词牌格律大全 全国快递公司大全 三门峡旅游景点大全景点排名 家用电器图片大全 痛经怎么快速缓解 冰心现代诗歌大全100首 火线精英视频大全 海鱼的做法大全 车标大全图片及名称