Hi,

hopefully someone can comment on an idea I have.

I have a VB backend that I talk to via a socket to handle db access. When a
connection is made to the back end I put a Boolean value of TRUE under the
"active" key in the application session. If for whatever reason the VB
backend goes down I get the key "active" and set it to FALSE. I created a
tag that as the user goes from page to page it checks this key and if it is
active it continues displaying the page and if it is not it takes the user
to a generic, back end down page.

A problem I found is that a user could be on a page and submit data to a
servlet. If the backend has gone down while the user has been on a page, the
servlet will not know about it and attempt to do some work. I do not want
this to happen. I want a similar set-up that I have for the pages for the
servlet.

I was thinking of overriding the doGet and Post methods of the ActionServlet
to check if the "active" key is true. If it is continue passing the request
to the servlets if it is not then send them to a generic, back end not
available page.

Something like this:

public void doPost(HttpServletRequest request, HttpServletResponse response)
throws java.io.IOException, javax.servlet.ServletException
  {
String errorPage="/serverNotAvailable.jsp";
if(key)
        {
                //do usual work
        }
else
        {
                RequestDispatcher disp=new request.getRequestDispatcher(errorPage);
                disp.forward(request,response);
        }

super.doGet(request, response);

any comments are appreciated.

Alex

Reply via email to