I have to use loading bar on selected actions in Struts2, & am using ServletActionContext, but getting NullPointerException.
ActionContext.getContext().get(org.apache.struts2.StrutsStatics.HTTP_REQUEST);
If I remove execAndWait interceptor from xml configuration file, it works fine.
Some people suggested me to use SessionAware. Why so ?
Is there any solution ?
                        
The
ActionContextisThreadLocaland it doesn't have a request object when you run a background thread viaexecAndWaitinterceptor.If you use
SessionAware, then you should haveservletConfiginterceptor on the stack to be able to set the session object to your action before the action is executed.Solution: if you can get
ServletRequestAwareto set a request object to the action and useservletConfiginterceptor prior theexecAndWaitinterceptor in the stack. If you need to create a custom stack you should keep the order.