How to redirect the control from interceptor to jsp incase of error in interceptor

441 views Asked by At

How to pass the control from interceptor to a JSP. I have an interceptor where I make checks whether app server is up or down by reading a flag from Database. If app is down I need to redirect the control to JSP from the current interceptor. I tried declaring a result in <global-results> but it didn't work for me.

<global-results>
  <action name="downtime">
    <result>maintenancePage.jsp</result>
  </action>
</global-results>

Can any one suggest what to do?

1

There are 1 answers

3
Roman C On BEST ANSWER

The important part of the global result is that it should have a name and an absolute path.

<global-results>
    <result name="downtime">/maintenancePage.jsp</result>
</global-results>

You can return this result from any action or interceptor of the package where this result is defined or inherited, and you don't need it to configure to the action because it's global. This is a dispatcher type result, if you need other types you need to change the result configuration type attribute and probably a location.