http-redirectjbosscontextpath

How to auto direct to "my web application" from "root (/)" context in JBoss?


I am using JBoss 6.0 .

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).

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"?

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).

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.

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

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?


Solution

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

    For example keep following line only in index.html

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