Servlet redirect

Szűcs Attila <[email protected]> Mon, 23 Jul 2012 18:10:07 +0000
Newsgroups gmane.comp.jakarta.turbine.user
Message-ID <[email protected]>
I have a screen (lets call it page X) where I do an ajax call that populates a table, constructed with jqGrid. So here I call localhost/servlet/ajax/Data.json which is a servlet. Now, if the page expires and the user still wants to access the table (search data for instance) I would like to redirect the request to the Login page.

The ajax call calls the Data.json servlet that is not in the same servlet context as my Login page (which is localhost/servlet/myapp), therefore I cannot use servlet forward (I am using JBoss 4.2 and I can only forward in the same servletcontext).

I have tried to redirect with sendRedirect, which is able to call the Login page that is actually executed but not displayed. And this is where I got lost. My Login page is executed and I still see page X. I have tried to write the returned HTML (from Login page) into the response of page X. The HTML page is actually returned, but not displayed.

How can I redirect from the servlet so that the redirected page is displayed?

Thanks,
    Atti