The autocmpleter needs to get the data in some format, that format is JSON, the response needs to be something like:

[
  ["Text1", "Key1"],
  ["Text2", "Key2"],
]

Remember that what you return from "execute" is not the response, it is the result, like "success" or "input", so you can't return the json object from the action. What you can do, if you don't want to use freemarker, velocity or jsp to build the json object, is to write directly to the outpustream. Soon we will have a "json" result type, that will take care of serializing the action to a json string for you.

hope that helps
musachy

André Faria wrote:
What is necessary to write a JSON response in struts to use with a Autocomplete tag?

example:

public class JSONListAction {
   public String execute {
      ???????????????? return JSON  object!
   }
}

<s:url id="json" value="/JSONList.action" />
<s:autocompleter theme="ajax" href="%{json}" autoComplete="false"/>



Thank's
André Faria

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to