Grish wrote:
I'm using the ajax theme with my struts tags, based on the struts 2
tutorial, to implement ajax functionality. Where can I define my code to
catch the result and perform a redirect? I apologize for my inexperience.
I'm a little unclear on how to
hmm...ok, this is using Dojo 0.4 and it gets messy pretty quickly. I'd
probably use a different approach given that constraint but I'll come
back to that issue in a moment.
Basically with the tags you have two options:
- subscribe to a Topic for all of the ajax operations. There should be
a topic for when the response is received or handling an error response.
- use a custom handler that performs the posts.
I don't recall the details because I don't use these tags any more.
Topics are touched on at [1] and [2] but you're quite limited in 2.0.x
compared to 2.1.x.
Dojo may have some global events but you'll have to search the API.
Given that constraint, I'd use these basic approaches:
- return an HTML fragment for failed ajax requests instructing the
user to login with an appropriate link; and/or
- return an HTML fragment that also contains inline javascript that
performs a redirection to the login page. Make sure you have
separateScripts=false and executeScripts=true on all the dojo tags.
I consider the latter case a hack but it should work with this version
of Dojo in all the relevant browsers.
Hope that helps!
[1] http://struts.apache.org/2.0.11/docs/ajax-tags.html
[2]http://struts.apache.org/2.0.11/docs/ajax-and-javascript-recipes.html
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]