• 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
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Struts 2: Succes not redirecting when using Ajax Validation

 
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!
 
Ranch Hand
Posts: 213
Eclipse IDE Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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:

 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
@David Newton: Yes, I'm using ajax submit with the struts2-jquery library. The submit looks like this:

 
Be reasonable. You can't destroy everything. Where would you sit? How would you read a tiny ad?
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic