Note that there are some explanatory texts on larger screens.

plurals
  1. POAutocompleter Struts 2 jQuery
    primarykey
    data
    text
    <p>I have read a lot on this topic &amp; know how it should work but anyhow I am not successful in running code.</p> <p>The below presented code is running but do not load <code>JSONObject</code>.</p> <p><strong>Here is my <code>x.jsp</code>:</strong></p> <pre><code>&lt;%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%&gt; &lt;%@ taglib prefix="s" uri="/struts-tags"%&gt; &lt;%@taglib uri="/struts-dojo-tags" prefix="sx"%&gt; &lt;!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"&gt; &lt;html&gt; &lt;sx:head /&gt; &lt;head&gt; &lt;meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"&gt; &lt;title&gt;Auto complete example&lt;/title&gt; &lt;/head&gt; &lt;body bgcolor="lightblue"&gt; &lt;h2&gt;Welcome to India&lt;/h2&gt; &lt;s:url id="optionsUrl" action="g" /&gt; &lt;sx:autocompleter href="%{#optionsUrl}" loadOnTextChange="true" loadMinimumCount="3" value="Florida" keyValue="FL" /&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p><strong>Here is <code>struts.xml</code>:</strong></p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8" ?&gt; &lt;!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN" "http://struts.apache.org/dtds/struts-2.0.dtd"&gt; &lt;struts&gt; &lt;constant name="struts.devMode" value="true" /&gt; &lt;package name="default" namespace="/" extends="json-default"&gt; &lt;action name="g" class="com.AutoCompleter"&gt; &lt;result type='json'&gt; &lt;param name="root"&gt;options&lt;/param&gt; &lt;/result&gt; &lt;/action&gt; &lt;/package&gt; &lt;/struts&gt; </code></pre> <p><strong>Here is my Action Class:</strong></p> <pre><code>package com; import java.util.HashMap; import java.util.Map; import com.opensymphony.xwork2.ActionSupport; public class AutoCompleter extends ActionSupport { public Map&lt;String, String&gt; getOptions() { System.out.println("Hello"); Map&lt;String,String&gt; options = new HashMap&lt;String,String&gt;(); options.put("Florida", "FL"); options.put("Alabama", "AL"); return options; } } </code></pre>
    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.
 

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