Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Execandwait Interceptor - Issue

 
Mathew Geraldo
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic