I dealt with the ajax result discrepency (ie, if you make an ajax request, you generally want a different result, but probably want to share the same action) by writing a few things: 1) A sitemesh filter that ignores requests with the content header X-Requested-With=XMLHttpRequest 2) An Interceptor and interface for dealing with Ajax requests that allows you to specify a different result. The method is called "beforeResult" allowing you to change it if necessary. 3) A way to ask for views: sharing actions creates extreme complexity if you have multiple pages that have different results under different contexts (ie, a get on a resource may return a specific html fragment if it is requested from a list view, which is different from what should happen if it's requested from a regular "get" view on the resource). To deal with this, i basically let the view specify the returning "view" of the data from the ajax request by just adding a request param = RespondWith=user/row-view, and then translate that into the appropriate jsp and return on server side. This currently operates in a few different places (ie, a base action, a generic jquery script, and interceptors/interfaces).
I'd be happy to share the code, but I think what this starts to get at is the same thing that has come up a few times on this list - what exactly is struts trying to become? I also have code to allow auto-retrieval of JPA entities on an action using an interceptor. The question for me is where should struts stop and some sort of integrating framework start? I do think it would be nice to have a REST, JPA, Struts, Ajaxy app framework that is ready to go with Sitemesh, etc and lets you just start building out actions and take advantage of all this stuff, but I don't know where it should live. It starts to sound like Appfuse specifically geared to Struts at some point too. Anyone have any thoughts? Blake On Thu, Feb 21, 2008 at 12:15 PM, Ian Roughley <[EMAIL PROTECTED]> wrote: > > Dave Newton wrote: > > --- Musachy Barroso <[EMAIL PROTECTED]> wrote: > > > >> On Thu, Feb 21, 2008 at 2:03 AM, Al Sutton <[EMAIL PROTECTED]> > wrote: > >> > >>> Before a GA release of 2.1 I'd ideally like to see dojo upgraded to > the > >>> latest, greatest stable version, > >>> > >> I have totally changed my position about the dojo plugin. I think > >> Struts should have some ajax functionality for the most commom use > >> cases, but I think we just picked the wrong ajax framework. > >> > Also my conclusion when the ajax code was ported from ww2 to s2. And I > was really happy when you took over maintaining the code ;-) > > > > Yikes. > > > > The issue with the Dojo plugin (and any other, like my somewhat-waylaid > > jQuery plugin) is that I end up writing all the JavaScript anyway, and > the > > tags don't help me very much in all but the *most* basic use-cases. > > > The other conclusion I came to, about the same time as above. To take > jQuery (which I've being working with a bit lately), even if you have a > s2 plug-in/theme, there may need to be continuous updates or additions > depending on the different plug-ins being used with the jQuery core. > Also, with jQuery again, in some cases you will also need to take into > account whether the page being returned is part of an ajax request itself. > > > >> Jeromy is working on the YUI plugin and I will give it a hand, maybe > >> that will be a better option in the future. > >> > > > > The Microsoft YUI? :D > > > > Dave > > > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > >