0

In my Web Application I have jqGrid and other struts2 jquery plugins , now what i want is to have have a global error handler function that will redirect to my index page if error occurs any idea how can I implement this functionality.

Haider
  • 615
  • 1
  • 16
  • 38

1 Answers1

0

You can use Interceptor to manage your exception on application level. Also see this document for exception-handling in struts.

You can also use global-results to fulfill your needs

If you handle exceptions by redirecting to index page it will only behave in desired manner when request are generated by browser directly rather than Javascript asking browser to generate request using Ajax. e.g. by clicking on anchor tag or directly accessing application through URL. In these conditions only you will get redirect to index page.

Ajax is used to send data to, and retrieve data from, a server asynchronously (in the background) without interfering with the display and behavior of the existing page on client side. Javascript responsible for calling Ajax has to handle response from server. So you have to manually trigger redirect. Have a look at this related Question.

Community
  • 1
  • 1
Yogesh
  • 4,546
  • 2
  • 32
  • 41