Note that there are some explanatory texts on larger screens.

plurals
  1. POQuestion on Struts 2 and Struts-jQuery Autocompleter
    primarykey
    data
    text
    <p>Update: I get the result using firebug, but the result doesn't show on the pages? Anyone knows why?</p> <p>the result are like :</p> <pre><code>{"results":["hello","bye"]} </code></pre> <p>(PS: the jason plugin I posted is deprecated, which fires an error. I switched to the default struts-jason-plugin now).</p> <p>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:</p> <pre><code>&lt;sj:autocompleter name="movieName" id="movieName" href="%{jsonlanguages}" delay="50" loadMinimumCount="2" &gt;&lt;/sj:autocompleter&gt; </code></pre> <p>jsonlanguages refers to a action, which i defined it like </p> <pre><code> &lt;s:url id="jsonlanguages" action="movieLiveSearch"/&gt; </code></pre> <p>now the current state is that this action is called when user type in the autocompleter, but no dropdown list containing results are returned.</p> <p>My Action's execute function is defined like this:</p> <pre><code>public String display() throws IOException { System.out.println("execute movie live search"); results.add("hello"); results.add("goodbye"); return "SUCCESS"; } </code></pre> <p>where results is defined as </p> <pre><code>private List&lt;String&gt; results; </code></pre> <p>currently i just wanna return the variable results.(leave db apart for now). And my struts.xml file:</p> <pre><code>&lt;result-types&gt; &lt;result-type name="json" class="com.googlecode.jsonplugin.JSONResult"/&gt; &lt;/result-types&gt; &lt;action name="movieLiveSearch" class="proj.MovieManagement.controller.MovieLiveSearchAction" method="display"&gt; &lt;result type="json" name="SUCCESS"&gt;admin.jsp&lt;/result&gt; &lt;/action&gt; </code></pre> <p>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?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload