Hi,
I am new to
struts . Please help me in implementing autocompleter tag in textbox.
My
java action is ::
public class HelloWorld extends ExampleSupport {
private Map<
String,String> testingMap;
private List<String> testingMapKeys;
public String execute() throws Exception {
testingMap = new HashMap<String,String>();
testingMapKeys= new ArrayList<String>();
testingMap.put("TREE","DEL");
testingMap.put("HELLO","MUM");
testingMapKeys.add("TREDD");
testingMapKeys.add("TREND");
return SUCCESS;
}
public Map<String,String> getTestingMap() {
return testingMap;
}
public List<String> getTestingMapKeys() {
return testingMapKeys;
}
}
My
Jsp is ::
...
<%@ taglib prefix="s" uri="/struts-tags" %>
<%@ taglib prefix="sx" uri="/struts-dojo-tags" %>
...
<head>
<title><s:text name="HelloWorld.message"/></title>
<sx:head debug="true"/>
</head>
...
<body>
<s:url id="cityTest" action="HelloWorld" />
<sx:autocompleter name="origin" href="%{cityTest}" showDownArrow="false" autoComplete="false" dataFieldName="testingMap" />
...
My Struts .xml
<package name="example" namespace="/example" extends="json-default">
<action name="HelloWorld" class="example.HelloWorld">
<result type="json">/example/HelloWorld.jsp</result>
</action>
.....
</package>
Please tell me where i am wrong. I am unable to get back values of testingMap in Json format in my Jsp. At first i am unable to get to my Jsp page. Please help me with theme ="ajax"