idea(2021.3)上配置struts框架步骤

步骤一:下载struts框架所需jar包

官网地址:Download a Release

步骤二: 在idea里面下载关于struts的配置

点击file------>setting,下载struts2配置,并安装好。

步骤三:创建一个struts框架的项目 

这样我们就创建好了一个struts框架的项目,如下所示。

 步骤四:导入jar包并配置好

在web-info下面创建一个lib,并将jar包导入+配置好。

导入:

配置: 

        一、

        二、 

         三、

        四、 

这样我们就配置好了一个struts框架的项目了,然后我们把web.xml以及struts.xml里面的东西配置好就可以使用了。

其中web.xml中要填写的是

<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd"
         version="4.0">
<filter>
        <filter-name>struts2</filter-name>
        <filter-class> org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter</filter-class>
    </filter>
    <filter-mapping>
        <filter-name>struts2</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>

 struts.xml中要填写的是


<!DOCTYPE struts PUBLIC
        "-//Apache Software Foundation//DTD Struts Configuration 2.5//EN"
        "http://struts.apache.org/dtds/struts-2.5.dtd">

猜你喜欢

转载自blog.csdn.net/qq_46586512/article/details/121805313