前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >(03)Struts2_搭建环境

(03)Struts2_搭建环境

作者头像
qubianzhong
发布2018-09-19 13:03:29
2990
发布2018-09-19 13:03:29
举报
文章被收录于专栏:行者常至行者常至

Struts2_搭建环境

  • 加入 jar 包
  • 在 web.xml 文件中配置 struts2
  • 在当前 web 应用的 classpath 下添加 struts2 的配置文件 struts.xml

加入jar包

这里写图片描述
这里写图片描述
https://yunpan.cn/cMerTYnrfvMcU 访问密码 0e93

web.xml中配置struts2

代码语言:javascript
复制
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" id="WebApp_ID" version="3.1">
  <display-name>struts2-02</display-name>
  <welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
  </welcome-file-list>

  <!-- 配置Struts2的过滤器 -->
  <filter>
    <filter-name>struts2</filter-name>
    <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
  </filter>
  <filter-mapping>
    <filter-name>struts2</filter-name>
    <url-pattern>/*</url-pattern>
  </filter-mapping>

</web-app>

添加struts.xml

代码语言:javascript
复制
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC
    "-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
    "http://struts.apache.org/dtds/struts-2.3.dtd">
<struts>

</struts>
其中
代码语言:javascript
复制
<!DOCTYPE struts PUBLIC
    "-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
    "http://struts.apache.org/dtds/struts-2.3.dtd">
可在 struts2-core-2.3.15.3.jar 中复制
这里写图片描述
这里写图片描述
至此,环境搭建完成,接下来我们来完成helloworld。
本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2016年09月01日,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • Struts2_搭建环境
  • 加入jar包
    • https://yunpan.cn/cMerTYnrfvMcU 访问密码 0e93
    • web.xml中配置struts2
    • 添加struts.xml
      • 其中
        • 可在 struts2-core-2.3.15.3.jar 中复制
          • 至此,环境搭建完成,接下来我们来完成helloworld。
          领券
          问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档