I am trying to send javascript object to Struts2 autocompleter action through parameter. But it doesn't work.
Here is my code:
<script>
var nameList = new Array();
function func1(element)
{
console.log(element.value);
var index = nameList.indexOf(element.value);
element.checked ? nameList.push(element.value) : nameList.splice(index,1);
console.log(nameList.length+"---- "+nameList);
}
</script>
<s:form name="baseForm" id="baseForm">
<table width="100%" >
<tr>
<td ><s:text name="Units" /></td>
<td>
<s:iterator value="units" status="itr" id="un">
<input type="checkbox" onclick="func1(this)"
name="unitList[<s:property value="#itr.index"/>]"
value="<s:property value="#un" />" />
</s:iterator>
</td>
</tr>
<tr>
<td ><s:text name="Groups"/></td>
<td width="80%">
<sd:autocompleter href='get_groups.action?unitList=%{nameList}' id='unitAutoComplete' name='unitGroup' loadOnTextChange='true'
loadMinimumCount='1' showDownArrow='false' autoComplete='false' />
</td>
</tr>
</table>
</s:form>
Based on the Units selected, Groups should get populated in autocompleter.
So my first question is Is it possible to send javascript object into struts2 action through paramaters?
If it is yes, please suggest me how to pass the javascript object as parameters in action.