Struts 2 execAndWait interceptor example
The execAndWait interceptor also known as execute and wait interceptor is used to display the intermediate result.
It is recommended to use for long running action.
It is not found in the default stack bydefault. So you need to specify it explicitely.
If you don't specify "wait" result, struts framework displays an intermediate result until your request is completed.
For the custom intermediate result, you need to define "wait" result in struts.xml file. In your page, you can display processing image etc. So, it is better to specify the custom result.
Parameters of execAndWait interceptor
There are 3 parameters defined for execAndWait interceptor.
Example of execAndWait interceptor without wait result
Let's see the simple example of execAndWait interceptor without wait result. In such case, struts framework provides an intermediate result.
Example of execAndWait interceptor with wait result
Let's see the simple example of execAndWait interceptor with wait result. In such case, your intermediate page is invoked.
Let's write the code for intermediate result. The s:url tag will forward the request to specified url.
It will be refreshed at 0.5 seconds.