I have actually been working slowly but steadily on the struts2-jquery plugin that was discussed awhile back ( http://code.google.com/p/struts2-jquery-plugin). Sorry for the radio silence. It's now fairly comprehensive and barring after a few TODOs (see below) , probably ready for some very early-adopter use or perhaps better to integrate with Wes' efforts. I have implemented the following tags so far:
*head*: injects required javascript libraries (including the jquery.subscribe which I've released) *div*: implements dynamic loading, reloading, topics listeners (eg. onSuccess, onError, onComplete, onAlways, ...) *a*: load to dynamic targets, serializes forms and individual elements, topic listeners, publishing on events, progressIndicator *form*: submit to dynamic target, topic listeners. *submit*: similar to anchor *select*: dynamic loading (requires result returned as json) *tabbedpane *& *tab*: dynamic loading, reloading, disabling, topic listeners, publish on events TODOs: - Build sample/test app - I have been testing quite a bit but only on an app that I'm currently building for someone. Wes, you had said that you were putting together a sample app in the sandbox, perhaps we can combine work and work there. - Proper documentation - documentation on site wiki is sparse and out of date - Finalize and test validation on form/submit/anchor tags - Add structured support for jquery 'theming' and internationalization - Some of the attributes may not be the most intuitive or 'struts-like' and should be fixed (for example the anchor tag takes an 'href' instead of an 'action') A couple of things: - My approach has been far more akin to the easy-to-use, out-of-the-box ajax attributes (similar to dojo but much more lightweight) than the approach Wes has taken so far. IMO both are useful. As Wes said, this provides a standardized easy to adopt framework that a majority of struts-users may want. simultaneously, we can work on providing a lower-level framework that may ultimately replace/support this and provide a client-side view foundation, managing interactions between components, optimised server communication, etc. - The html produced by the tags is not always standard (non-standard attributes are set in elements). I'm not sure if most would consider this undesirable or an issue. The benefit of having it as it is is that the jquery binding logic is fully contained in a single javascript file (jquery.struts2) rather than trying to embed complex javascript into the page which would make the templates complex and difficult to maintain. - It doesn't explicitly require the json plugin or any other, however the select tag expects valid json for asynchronous loading for which one would almost certainly use the json plugin. - I've tried to integrate the tags with the simple struts tags as much as possible to allow users to make use of both the standard and ajax feature where possible (for example, the select tag can still be populated from a list in jsp but public an onChange topic. - I have implemented both freemarker and javatemplates templates for the tags, however using the freemarker templates requires some extensibility updates to the javatemplates plugin (I have included an updated plugin.jar with the source). Awhile ago, I submitted a patch to make the javatemplates plugin a bit more extensible to allow custom themes and struts configuration. Dave Newton updated the patch and applied/assigned to JIRA ( https://issues.apache.org/struts/browse/WW-3009). The issue is currently pending and still unassigned. I'm keen for this to make it into 2.1.7. Any idea if/when this can be done? The patch needs to be updated a bit for the StringUtils refactor. I would be very happy to contribute. In general is there any movement on the javatemplates plugin for 2.1.7 (for example there are a number of tags that still need to be implemented in SimpleTheme)?. As I mentioned, the javatemplates code i have depends on the changes in the patch, so is currently broken on latest build. -Eric 2009/4/13 Wes Wannemacher <[email protected]> > On Sunday 12 April 2009 14:43:44 Frans Thamura wrote: > > > Right now the plugin doesn't require the JSON plugin. It uses the > > > JSONValidationInterceptor to handle validation with AJAX form > submission. > > > So, it only depends on core. I didn't want to be dependent on a > > > non-hosted plugin and figured it was time to bring JSON into the core. > I > > > think Musachy and I figured we'd be able to get it brought in quicker > > > than has happened. > > > > my cimande project wants to have this feature > > > > http://www.blueoxygen.org/wiki/index.php/Cimande:Architecture > > > > we inject the interceptor within spring, and make the form submission > > translate automatically to hibernate model. > > > > can share your JSONValidationInterceptor concept ? > > > > i think we need to execute an action for every form submission > > > > F > > Frans, > > Check out this page - > > http://struts.apache.org/2.x/docs/ajax-validation.html > > In particular, check out the prototype example, it gives a good explanation > of > how to use the validation outside of the normal Dojo plugin. > > -Wes > > -- > > Wes Wannemacher > Author - Struts 2 In Practice > Includes coverage of Struts 2.1, Spring, JPA, JQuery, Sitemesh and more > http://www.manning.com/wannemacher > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > >
