如何自动定向到“我的网络应用程序"来自“根(/)"JBoss 中的上下文? [英] How to auto direct to "my web application" from "root (/)" context in JBoss?

查看:30
本文介绍了如何自动定向到“我的网络应用程序"来自“根(/)"JBoss 中的上下文?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是 JBoss 6.0.

I am using JBoss 6.0 .

我已经在网络上下文中部署了我的网络应用程序:myApp.ear:/test".所以在浏览器 url 中,如果我输入http://localhost:8080/test/",我确实得到了我的登录页面 (myLogin.jsp).

I have deployed my web application: myApp.ear under the web-context: "/test". So in browser-url if I type "http://localhost:8080/test/", I do get my login page (myLogin.jsp).

由于我的 WAR 存在于 EAR 文件中,因此我在 application.xml 文件中使用 Web 模块内的 context-root 元素指定了上下文根 -即

Since my WAR exists inside a EAR file, I have specified the context root in the application.xml file using a context-root element inside of the web module - i.e.

<module>
    <web>
        <web-uri>myWeb.war</web-uri>
        <context-root>/test</context-root>
    </web>
</module>

我的问题是如何将用户从根上下文"自动定向到我的网络应用程序?

My question is how to auto direct user to my web-app from "root context"?

我的意思是如果用户输入http://localhost:8080/",我希望我的网络应用程序的登录页面能够加载(而不是 JBoss 的默认 ROOT.war 的 index.html 页面).

I mean if user types "http://localhost:8080/", I would expect my web-application's login page to load (instead of JBoss's default ROOT.war's index.html page).

我从 {JBOSS}serverdefaultdeployROOT.war 中删除了现有的 index.html 并在那里创建了 login.jsp.现在我可以看到,当我输入 http://localhost:8080/ 时,login.jsp"正在被调用.但我无法将用户请求重定向到我的网络应用程序的登录页面.

I deleted existing index.html from {JBOSS}serverdefaultdeployROOT.war and created a login.jsp there. Now I can see that "login.jsp" is getting invoked when I type http://localhost:8080/. But I can not redirect user-request to my web-app's login page.

在那个 login.jsp 中,我尝试过:<jsp:forward page="/test"/>,但出现错误:HTTP 状态 404 -/test".

In that login.jsp, I have tried with: <jsp:forward page="/test" />, but I get error: "HTTP Status 404 - /test".

如果我像 <jsp:forward page="/test/myLogin.jsp"/> 这样调用,我仍然会遇到相同的 404 错误.

If I invoke like <jsp:forward page="/test/myLogin.jsp" /> I still get the same 404 error.

有人可以建议如何从根上下文自动定向到我的网络应用程序吗?

Can any one suggest how to achieve the auto-direct to my web-app from root-context?

推荐答案

您需要将 index.html 保留在默认部署文件夹中,并将请求转发到您的 Web 模块.

You need to keep index.html in default deploy folder and forward request to your web module.

例如仅在 index.html 中保留以下行

For example keep following line only in index.html

<META HTTP-EQUIV="Refresh" CONTENT="0; URL=/test/"/> 

这篇关于如何自动定向到“我的网络应用程序"来自“根(/)"JBoss 中的上下文?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆