aspose file tools*
The moose likes Struts and the fly likes Struts 2: Succes not redirecting when using Ajax Validation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts 2: Succes not redirecting when using Ajax Validation " Watch "Struts 2: Succes not redirecting when using Ajax Validation " New topic
Author

Struts 2: Succes not redirecting when using Ajax Validation

Emili Calonge
Ranch Hand

Joined: May 17, 2003
Posts: 84
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

Joined: May 05, 2010
Posts: 213

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

Joined: Sep 29, 2008
Posts: 12617

@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

Joined: May 17, 2003
Posts: 84
@David Newton: Yes, I'm using ajax submit with the struts2-jquery library. The submit looks like this:

 
Consider Paul's rocket mass heater.
 
subject: Struts 2: Succes not redirecting when using Ajax Validation