日期:2014-05-17  浏览次数:20809 次

jetty如何设置欢迎页面
现在直接访问127.0.0.1:80是jetty自己的欢迎页面,我通过什么办法能够把这个页面换成我自己某个war包里面的html网页。。求大神指点下

------解决方案--------------------
在etc目录下有个webdefault.xml,在里面改。jetty默认是配置了3个欢迎页

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

这个优先级高于web.xml
------解决方案--------------------
引用:
Quote: 引用:

在etc目录下有个webdefault.xml,在里面改。jetty默认是配置了3个欢迎页

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

这个优先级高于web.xml

好吧,大神真出现了。。。加入我要把webapps目录下app.war 里面的index.html设置成页面的话。。。这三个应该怎么填--删掉两个留一个就可以了么--


随便删,至少要对应到你的项目下的某个页面就行
------解决方案--------------------
欢迎页面可以设置多个,但系统会从第一个开始查找,找到后就停止了,找不到就接着向下找。
<welcome-file-list>
    <welcome-file>index.html</welcome-file>
    <welcome-file>index.htm</welcome-file>
    <welcome-file>index.jsp</welcome-file>
  </welcome-file-list>

上面的例子,系统会先找index.html,找到的话就不再向下找了。找不到的话就继续找index.htm,还找不到就找index.jsp
------解决方案--------------------
引用:
Quote: 引用:

Quote: 引用:

对,这个我明白,但是我要做的是把ip:port直接设置成访问app这个war包下的index.html,而不是访问ip:port/context
 你直接在ip:port 后面的欢迎页面中做个重定向跳转,跳转到你的工程里面的欢迎页面就是了 

--。。。。这个。。。还有没有其他更好的办法--
这个就是我能想到的最简单的方法了,重定向就一行代码,方便快捷。