I believe there are two JQuery plugins for Struts2 and I have been using
the one from http://code.google.com/p/struts2-jquery/ for a little bit
now. For very basic JQuery functionality I have not found any issues
with this plugin; however when one wishes to do something more complex,
I am finding it's better to simply use JQuery directly; however I want
to avoid all these scripts in my JSPs if I could. For example:
jQuery(document).ready(function() {
$("#itemsList").autocomplete(
{
source:function(request,response) {
// do some stuff here, including $.ajax
// to server to get data for autocomplete widget
},
select:function(event, ui) {
// once an item is selected, take ui.item.value
// and set the value of a few other fields
},
// more options...
});
});
Obviously I could very easily drop this into a JS file; however the
source function() above needs to be able to take a Struts2 action and be
able to create the URL that is appropriate to the current context.
Obviously, I could write my own taglib that allows me to specify all the
parameters, attributes, etc for such a widget and it would inject the
javascript when the page is rendered; however I'd prefer to see if there
is a way I can easily extend the current plugin I am using or if there
is a better plugin I could use to get the same results or whether just
using JQuery directly is the acceptable route in this case...
Chris
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]