右键new web.xml,怎么新建?

来源:4-1 Shiro集成Spring

等一束花開3990875

2018-05-23 15:59

我右键new 没有web.xml 这个选择,请问怎么新建一个xml?https://img4.mukewang.com/5b051f130001f2d505410495.jpg

写回答 关注

2回答

  • victoriaMay
    2018-05-24 10:11:59
    已采纳

    右键创建不了,我试过~


    等一束花開3...

    非常感谢!

    2018-05-24 14:56:17

    共 1 条回复 >

  • victoriaMay
    2018-05-24 10:11:17

    https://img.mukewang.com/5b061ed2000177ae13540929.jpg

    file—>Project Structure 

    如图所示

    但是你得自己写内容

    <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xmlns="http://java.sun.com/xml/ns/javaee"
             xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
             id="WebApp_ID" version="3.0">
    
        <context-param>
            <param-name>contextConfigLocation</param-name>
            <param-value>classpath*:spring.xml</param-value>
        </context-param>
    
        <!--spring 监听器-->
        <listener>
            <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
        </listener>
    
        <listener>
            <listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
        </listener>
    
        <!--shiro Filter-->
        <filter>
            <filter-name>shiroFilter</filter-name>
            <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
        </filter>
    
        <filter-mapping>
            <filter-name>shiroFilter</filter-name>
            <url-pattern>/*</url-pattern>
        </filter-mapping>
    
        <!-- 解析springMvc -->
        <servlet>
            <servlet-name>springDispatcherServlet</servlet-name>
            <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
            <init-param>
                <param-name>contextConfigLocation</param-name>
                <param-value>classpath*:spring-mvc.xml</param-value>
            </init-param>
            <load-on-startup>1</load-on-startup>
        </servlet>
    
        <!-- 拦截器 拦截所有 -->
        <servlet-mapping>
            <servlet-name>springDispatcherServlet</servlet-name>
            <url-pattern>/</url-pattern>
        </servlet-mapping>
    
    </web-app>


Shiro安全框架入门

从零入门Shiro安全框架

48040 学习 · 332 问题

查看课程

相似问题