• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Execandwait Interceptor - Issue

 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic