File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes Add Database down alert Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Add Database down alert" Watch "Add Database down alert" New topic

Add Database down alert

vicky sha

Joined: Jul 11, 2012
Posts: 2
I wanted to add Database down alert for all jsp pages and i can do it in single page. As there are almost 1000 pages in my project, anyone can tell me where should i call database down alert function so that it can be accessible at every page reload and throw the user at error page.
Thanks in advance.
Pyla Rao
Ranch Hand

Joined: Jul 10, 2012
Posts: 51
We can use custom exception handling for those types of alerts.
vicky sha

Joined: Jul 11, 2012
Posts: 2
I have used the same for single jsp file(action script of it) and its working fine. But the problem is i have almost 1000 jsp files(including action scripts) and add these exception handling in all action script is not a good idea.
So i need to know how do i make changes to any single action script or controller so that it can be called at any page reload?
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42965
A servlet filter that transforms the response -maybe by inserting a JavaScript alert at the end of the response- can do this.

A better approach would be to do this in a JSP fragment that all pages include, but that would mean altering all JSP pages.

As an aside, if you have that many JSPs, then it may be time to redesign the app to use a CMS.
I agree. Here's the link:
subject: Add Database down alert
jQuery in Action, 3rd edition