如何自动定向到“我的网络应用程序"?来自“根(/)"; JBoss中的上下文? [英] How to auto direct to "my web application" from "root (/)" context in JBoss?
问题描述
我正在使用JBoss 6.0.
I am using JBoss 6.0 .
我已在以下Web上下文中部署了我的Web应用程序: myApp.ear :"/test ". 因此,如果在浏览器网址中输入" 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文件中,因此我已使用Web模块内部的 context-root 元素在 application.xml 文件中指定了上下文根-即
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/ ",我希望加载Web应用程序的登录页面(而不是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} \ server \ default \ deploy \ ROOT.war 中删除了现有的 index.html ,并在那里创建了一个login.jsp.现在,当我键入 http://localhost:8080/时,我可以看到正在调用"login.jsp".但是我无法将用户请求重定向到我的Web应用程序的登录页面.
I deleted existing index.html from {JBOSS}\server\default\deploy\ROOT.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.
有人建议如何从根上下文实现对我的Web应用程序的自动定向吗?
Can any one suggest how to achieve the auto-direct to my web-app from root-context?
推荐答案
您需要将index.html保留在默认的deploy文件夹中,并将请求转发到您的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屋!