struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Frank W. Zammetti" <>
Subject Re: Struts and AJAX
Date Mon, 03 Jul 2006 21:47:06 GMT
draegoon Z wrote:
> That CodeExecuter is nice!

Thanks!  The interesting thing is that as of beta5, it doesn't matter 
what response handler you use, the script blocks will ALWAYS be 
executed.  That's why there's a seemingly superfluous DoNothing 
handler... you may want to use that instead of CodeExecuter in some cases.

> About below, I'm talking about when my MyForm (extends ActionForm, not 
> Action) returns
> an ActionErrors object as it is configured in the example struts-config 
> below.
> Like if "to"  parameter was supposed to be a valid email address and 
> someone
> entered: blah blah blah
> Will this be handled normally, like a Non-Ajax struts action app, 
> returning the
> input mapping to display the errors, or whatever else.

That's what I kinda thought you meant :)  I got confused because you 
showed an action mapping... anyway... if you took an existing Struts app 
that handled this, then no, APT would probably not work right... 
although it still could... imagine if the page that the input JSP 
renders is displayed in an iFrame... in that case, you could use the 
std:IFrame handler to re-render it, so you wouldn't have to change a 
thing about your app.  Likewise, you could display it in a <div> and get 
the same effect.

However, more than likely your app isn't built this way today, so it 
wouldn't work unaltered.  What you would more than likely do is copy the 
action mapping that uses that MyForm, and change the input attribute to 
point to a JSP that renders just a snippet of markup displaying the 
error.  Then, insert that markup into a <div> using std:InnerHTML, or 
maybe pop it in an alert() with std:Alerter, etc.  This way, you kind of 
have a "parallel" action mapping, one for the AJAX request, one for the 
regular form submission (I've done this in a proof of concept by the 
way, it works great).

> -Joe


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message