tags:

views:

76

answers:

1

Hi, I want to create a drop down menu with autocomplete feature. I have a role object with properties roleId, roleDescription. My search box should only autocomplete on roleDescription. I followed this example:
http://code.google.com/p/struts2-jquery/wiki/AutocompleterTag

autocompleter-select.jsp

<sj:autocompleter 
                            id="roles" 
                            name="echo" 
                            list="%{roles}" 
                            listValue="roleDescription" 
                            listKey="roleId" 
                            selectBox="true"
/>

Autocompleter.java

@ParentPackage(value = "com.project.action")
public class Autocompleter extends BaseAction {

private String term;

@Actions( {
        @Action(value = "/autocompleter-select", results = { @Result(location = "autocompleter-select.jsp", name = "success") }),
        @Action(value = "/autocompleter", results = { @Result(location = "autocompleter.jsp", name = "success") }),
        })
public String execute() throws Exception {

    return SUCCESS;
}

public void setTerm(String term) {
    this.term = term;
}

public List<Role> getRoles() {
    System.out.println("getting roles");
    return services.getRoles();
}
}
A: 

Does it not work?

The @ParentPackage should referenced a Struts2 package defined in struts.xml and not an Java Package.

jogep
I changed ParentPackage to struts-default, it still doesn't work. :(
Nishant
I don't think jquery is triggering autocompleter action.
Nishant