Update: I get the result using firebug, but the result doesn't show on the pages? Anyone knows why?
the result are like :
{"results":["hello","bye"]}
(PS: the jason plugin I posted is deprecated, which fires an error. I switched to the default struts-jason-plugin now).
Hi everyone, i got a problem on making the working. I'm using the latest version of all the dependencies. (Struts 2.2.1) I wanna do a live search from database using . here's the code in my JSP file:
<sj:autocompleter name="movieName" id="movieName"
href="%{jsonlanguages}"
delay="50"
loadMinimumCount="2"
></sj:autocompleter>
jsonlanguages refers to a action, which i defined it like
<s:url id="jsonlanguages" action="movieLiveSearch"/>
now the current state is that this action is called when user type in the autocompleter, but no dropdown list containing results are returned.
My Action's execute function is defined like this:
public String display() throws IOException {
System.out.println("execute movie live search");
results.add("hello");
results.add("goodbye");
return "SUCCESS";
}
where results is defined as
private List<String> results;
currently i just wanna return the variable results.(leave db apart for now). And my struts.xml file:
<result-types>
<result-type name="json" class="com.googlecode.jsonplugin.JSONResult"/>
</result-types>
<action name="movieLiveSearch" class="proj.MovieManagement.controller.MovieLiveSearchAction" method="display">
<result type="json" name="SUCCESS">admin.jsp</result>
</action>
Personally, i think the action didn't return the result, but I have no idea how to do that, can anyone tell me how to fix things?