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

项目部署在jboss后,想输入IP地址比如http://222.256.26.12 就直接跳转到项目Project主页上去,避免每次都输入
http://222.256.26.12/Project/index.jsp 麻烦!

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

[quote]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. [/quote]


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



终于搞定了, 这样不是更简单了比上面的。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值