aspose file tools*
The moose likes Struts and the fly likes Execandwait Interceptor - Issue Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Execandwait Interceptor - Issue" Watch "Execandwait Interceptor - Issue" New topic
Author

Execandwait Interceptor - Issue

Mathew Geraldo
Greenhorn

Joined: Mar 27, 2013
Posts: 19
Hi,

I am trying to use the execandwait interceptor for a file upload in my struts2 application but no luck.
My jsp page that submits 'myAction' has some validations.
When I select a file and click submit, I am redirected to the wait page but then the wait page is refereshed and I am thrown back to inputPage.jsp with validation errors (File not selected).
It appears as if the action is being executed twice. Can anyone please help me.




struts.xml
<action name=myAction"
class="myActionClass" method="myMethod">
<interceptor-ref name="completeStack" />
<interceptor-ref name="execAndWait">
<param name="delay">1000</param>
<param name="delaySleepInterval">500</param>
</interceptor-ref>
<result name="wait">/WEB-INF/pages/wait.jsp</result>
<result name="success">/WEB-INF/pages/success.jsp</result>
<result name="input">/WEB-INF/pages/inputPage.jsp</result>

</action>

wait.jsp

<%@ taglib prefix="s" uri="/struts-tags" %>
<html>
<head>
<meta http-equiv="refresh" content="5;url=<s:url includeParams="all" />"/>
</head>
<body>
<h1>Struts 2 execAndWait example</h1>
<h3>Please wait while we process your request...</h3>
</body>
</html>



success.jsp

<%@ taglib prefix="s" uri="/struts-tags" %>
<html>
<head>
</head>
<body>
<h1>Struts 2 execAndWait example</h1>
<h3>Done</h3>
</body>
</html>
Mathew Geraldo
Greenhorn

Joined: Mar 27, 2013
Posts: 19
I solved this issue.
This might be helpful for others having the same issue as me.

I had a validate() method in my action class that was causing the issue.
I renamed it to myValidate() and explicitly called in my upload method in my action class.
This did it!
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Execandwait Interceptor - Issue
 
Similar Threads
How to use Struts2 interceptor-ref "execAndWait"?
ExecAndWait interceptor parameters lost
execAndWait problem
Problem with execAndWait interceptor
Struts2 - execAndWait Interceptor