This week's book giveaway is in the OCAJP forum.
We're giving away four copies of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) and have Khalid A Mughal & Rolf W Rasmussen on-line!
See this thread for details.
Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Struts 2: Succes not redirecting when using Ajax Validation

 
Emili Calonge
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a simple application, a form for creating users. The .java has two methods, the execute and an action for fetching a list of poblations.
So first I call to the fetch method wich gets the list and redirects to the form. The when I submit the form, the validation works perfectly, but when either an error happens or the action succeeds, nothing happens. I just get the destination page as an ajax message when the expected result would be a redirection.
So my configuration is as follows:

So first I call the registreUsuariPrepare action, then I get redirected to ublic/registreUsuari.jsp which contains the form, and when I submit the form, if the success or the error results are returned, I don't get redirected, I just get the contents of index.jsp or error.jsp as an Ajax response.
How can I avoid that and get redirected, what am I doing wrong?

My java is this:


I've tried adding

to the jsonValidationWorkflowStack, but it also doesn't work. I think it has to be something with this stack, but all the examples I've seen seem to work fine just like this.
Thanks!
 
Richard Golebiowski
Ranch Hand
Posts: 213
Eclipse IDE Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I ran into a similar issue when using the interceptor-ref in the action definition. What I had to do is add other interceptor references.
Try the following:

 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@Richard: servletConfig is already included in the JSON interceptor stack.

@Emili: Is this an Ajax form submit? You don't actually say.
 
Emili Calonge
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@David Newton: Yes, I'm using ajax submit with the struts2-jquery library. The submit looks like this:

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic