• java的struts2项目实现网站首页只显示域名不显示index.do的做法


    自己的网站快做完了,发现首页显示的时候总是跳转到http://www.xxxxxx.com/index.do

    而我想让http://www.xxxxxx.com/ 这样的方式来访问,不想带有后边的index.do

    首先想到的是在web.xml加上欢迎页:

    <welcome-file-list>
            <welcome-file>/index.jsp</welcome-file>
    </welcome-file-list>

    在index.jsp中:

    <%@ page contentType="text/html;charset=utf-8" %>
    <html>
        <header>
            <jsp:forward page="index.do" />
        </header>
    </html>

    但是这个时候并没有达到效果,还需要在web.xml里的struts过滤器里加上:

        <filter-mapping>
            <filter-name>struts</filter-name>
            <url-pattern>/*</url-pattern>
            <dispatcher>REQUEST</dispatcher>
            <dispatcher>FORWARD</dispatcher>
        </filter-mapping>
        此时启动程序,http://www.xxxxxx.com/就默认访问index.do了

  • 相关阅读:
    有继承的C++析构函数一定要用virtual
    CUDA vs2010配置
    lambda calculus(1)
    SICP练习1.6 1.16 解答
    用函数式来实现集合
    osx guile编译安装
    skiplist poj2892
    [转]理解 pkgconfig 工具
    专业术语解释
    【转】如何学习linux设备驱动
  • 原文地址:https://www.cnblogs.com/airfey/p/3175755.html
Copyright © 2020-2023  润新知