最简略配置JBOSS默认首页显示

最简单配置JBOSS默认首页显示
项目部署在jboss后,想输入IP地址比如http://222.256.26.12 就直接跳转到项目Project主页上去,避免每次都输入
http://222.256.26.12/Project/index.jsp 麻烦!

对jboss平常配置的少,懒得动脑筋花时间看文档,就直接baidu或者google用最快速度方法来找现成的。输入关键字
"JBOSS配置修改默认首页"  结果出来很多很多,其中最热门的我coyp了一份,如下:

引用
JBOSS配置日记之修改默认首页:

WEB项目发布的目录是,$JBOSS_HOME\server\default\deploy\jboss-web.deployer。格式是war包或是*.war的文件夹
在自己发布的项目的WEB-INF下新建jboss-web.xml,添加如下内容:
<jboss-web>
<context-root>/</context-root>
</jboss-web>
然后移除原有的ROOT.war
在下配置的是apache整合JBOSS,因此不需要修改apache的默认首页。

参考原文如下:
To install a web application that serves the root context (/), you need to specify the context mapping
using either the application.xml context-root element for the web module specification, or use a
context-root element in the war WEB-INF/jboss-web.xml descriptor:

<jboss-web>
    <context-root></context-root>
</jboss-web>

There is a special naming convention of ROOT.war that can be used to deploy a root context web app
without a jboss-web.xml descriptor. This is used to deploy a default root context app. This is found
under the jbossweb-tomcat50.sar deployment. This needs to be removed if you are deploying your own
root context application.



看来这篇文章靠谱了,我就按它的方式去配置,在我的Project工程的WEB-INF目录下放入一个jboss-web.xml(如上),
打上war包,丢进linux目录/usr/jboss/server/default/deploy,重新启动jboss,果然输入http://222.256.26.12
就进入了我的Project主页面。正准备收工,发现一个奇怪问题,浏览器上没出现工程Project名字,直接就是:
http://222.256.26.12/admin/Update.do, 按理来说应该是这样的:http://222.256.26.12/Project/admin/Update.do
,结果给省略了工程名,麻烦,瞎搞了一通,没成功,不知道具体在jboss哪里配置。
但在此瞎搞过程中,我突然想到了,默认是直接访问/usr/jboss/server/default/deploy/jbossweb-tomcat55.sar/ROOT.war
下的index.html的,为什么我不直接在index.html改下跳转到我的工程,于是我将index.html改成index.jsp 内容如下:

<%@ page language="java" pageEncoding="UTF-8"%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<script type="text/javascript">
		document.location.href = "http://222.256.26.12/Project";
	</script>
</head>

<body>
   <%
  	  response.sendRedirect("http://222.256.26.12/Project");
   %>
</body>

</html>



终于搞定了, 这样不是更简单了比上面的。
1 楼 21505720 2011-06-20  
自己顶下!