Hi
all,
Deploying 3 web-apps in one application in Orion; Outside, Inside and
Admin. Outside is mostly static, with a login section. The login section takes
the user to the Inside app by calling into it
via a /inside/Login.do?command=Login (using the popular Struts MVC
syntax). This all works. Using
Struts MVC (and even with my own), it appears that when trying to forward to a
different web-app context, its not possible. At least not yet..could be my
code. In MVC, the ControllerServlet running in one context, tries to forward
to a resource. Almost always this is in the same servlet-context (web-app) as
the ControllerServlet. In my case, I want a user to log out, which takes them
to the outside index.jsp page again. The normal RequestDispatcher() is part of
the Inside web-app context, so when it tries to forward to a /index.jsp, I
would think the / would indicate the context to forward to. This doesn't
appear to work. So then I tried using the ServletContext.getContext(url) call
where the url is the same as the forwarding resource. Thus, to forward from
any web-app to the outside "root" index.jsp page, I do something like:
getServletContext().getContext("/index.jsp").getRequestDispatcher("/index.jsp").forward(request,
response); This gets the right ServletContext of the root app. I have
tested this by creating an object and setting it as an attribute in the
/index.jsp, and in the ControllerServlet I get the ServletContext and look up
the attribute (before trying to forward), and it finds it. So when using that
ServletContext and trying to forward, its still not finding the page. I
continue to get 404 not found errors.
My
question is..is it possible to forward from one web-app to another? It appears
to work when I go from the / to the /inside context just fine (at least it
appears that on the JSP page using a href or form action url path of
/inside/Action.do, it does work by calling into the /inside web-app). I can't
imagine that deploying multiple web-apps limits you to not even forwarding to
another web-app. I do know you can't share any data between web-apps, but
being able to jump from one web-app to another via links and via forwarding
should work..shouldn't it? The API isn't exactly clear on this..but I will
look at it again.
Thanks.