struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ted Husted" <hus...@apache.org>
Subject Re: [S2+AJAX]Which ajax libray did you use?
Date Fri, 18 Jan 2008 10:44:26 GMT
On Jan 17, 2008 10:20 PM, Tony Zhang <zhjt80@hotmail.com> wrote:
> For YUI + struts2, do you prefer to use YUI plugin for struts2 or just use
> YUI directly? Do we need to use DWR to transfter data?

You can just use YUI directly. Essentially, what's being replaced is
the JSPs. With Ajax, we can start with an  HTML page and use
JavaScript to merge in the dynamic data returned from the server. No
taglib required.

With Ajax, the difference is not in the request, but in the response.
With Struts + Ajax, you can just make an ordinary request to an
Action, and let Struts convert  the input parameters for use with the
Action. To Struts, an Ajax request looks like any other request. The
Action can do what the Action always does. The key is that instead of
using a result that forwards to a JSP, we can use a result that
returns JSON or some other payload in the response. On the Ajax side,
the script uses whatever we return in the response to update the page.

The same strategy works just as well with Struts 1, and some people
have been doing this sort of thing with Struts 1 since before Jesse
gave us the name "Ajax".

DWR is also a good way to go, but it overlaps with Struts. I'd use one
or the other, and either one will get the job done. If you just need
to call a server side class from an Ajax page, DWR is ideal. Though,
it doesn't have any added-value features, like validation. Last I
knew, DWR also doesn't anything like an Interceptor stack to customize
handling of the request/response pipeline, or other results for other
formats, like JasperReports.


> Ted, I looked through your sample struts-pim.war. In that sample, you don't
> use YUI plugin for struts2, just using js to call the struts2 action
> directly. My question is which way is better,  YUI plugin or no YUI plugin?

So far, all the Dojo or YUI plugins do is add Ajax features to the JSP
tags. My preference is to go JSP free, which means there's no reason
to use the a JSP tag plugin.

If I were going to use tags, I'd probably go with the AjaxParts
taglib, which is covered by other other Ajax Experience presentation.

 * http://www.StrutsUniversity.org/Retrofitting+Struts+for+Ajax+Taglibs


HTH, Ted
<http://www.StrutsMentor.com/>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message