文章出處

自己的網站快做完了,發現首頁顯示的時候總是跳轉到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了

 

 


文章列表




Avast logo

Avast 防毒軟體已檢查此封電子郵件的病毒。
www.avast.com


arrow
arrow
    全站熱搜
    創作者介紹
    創作者 大師兄 的頭像
    大師兄

    IT工程師數位筆記本

    大師兄 發表在 痞客邦 留言(0) 人氣()