• Post Reply Bookmark Topic Watch Topic
  • New Topic

jquery + struts2 => JSON autocompleter example?  RSS feed

pooja par
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


I want to implement jquery autocompleter in my struts2 application.

I using the below link as reference.

I'm getting compilation errors when I add below annotations in my action class

@ParentPackage(value = "showcase")
@Action(value = "/jsonlanguages", results = {
@Result(type = "json", name = "success", params = {
"root", "languages"


<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="sj" uri="/struts-jquery-tags"%>
<sj:head jqueryui="true"/>
<td align="left"><s:label value= "Manager*:" cssStyle="font-weight:bold;"/></td>
<td align="left">
<s:url id="managerslist" action="ManagersAutoCompleter" />
<sj:autocompleter name="manager" id="managers" href="%{managerslist}" loadMinimumCount="2" />

my Action.java

public class ManagersAutoCompleter extends ActionSupport {

private static final long serialVersionUID = 1L;

private Map<String,String> managerMap = new HashMap<String,String>();
private String manager;

@Action(value = "/ManagersAutoCompleter",
results = {@Result(type = "json", params = {"root", "managers"})}
public String getManagers() throws Exception {
managerMap = ValidationManagerDAOImpl.getInstance().getManagers(getManager());
} else{
managerMap = new HashMap<String,String>();

return Action.SUCCESS;

public Map<String, String> getManagerMap() {
return managerMap;

public void setManagerMap(Map<String, String> managerMap) {
this.managerMap = managerMap;

public String getManager() {
return manager;

public void setManager(String manager) {
this.manager = manager;



<package name="json" namespace="/" extends="json-default">
<result-type name="json" class="com.googlecode.jsonplugin.JSONResult"/>
<action name="ManagersAutoCompleter" method = "getManagers" class="com.wellmanage.trading.eieio.actions.ManagersAutoCompleter">
<result type="json"><param name="root">managerMap</param></result>


Can anyone please help me with this..
I couldn't find complete source code for this example.

Please suggest me what else I need to add or it would be great if anyone can provide me complete souce code for this example
pooja par
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please refer to "struts2 jquery autocompleter"
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!