Details
-
Temp
-
Status: Closed
-
Major
-
Resolution: Not A Problem
-
2.1.8
-
None
-
None
-
windows vista,oracle 10g database
Description
based on a tutorial,i created an action called AutoCompleteCityAction and configured in struts.xml like
.....Action.java
package ajaxstruts;
import java.util.List;
import java.util.Map;
import java.util.HashMap;
import com.opensymphony.xwork2.ActionSupport;
public class AutoCompleteCityAction extends ActionSupport {
Map<String,String> json;
String city;
CitiesDAO dao;
public Map<String, String> getJson ()
public void setJson (Map<String, String> json )
{ this.json = json; }public String getCity ()
{ return city; }public void setCity (String city )
{ this.city = city; }
public AutoCompleteCityAction() {
}
public String execute()throws Exception
{ return SUCCESS; } public String getCities() {
if(city != null && (!city.isEmpty())) {
json = new HashMap<String,String>();
dao = new CitiesDAO();
List<City> list = dao.getCities(city);
for(City city: list)
}
return SUCCESS;
}
}
<package name="ajaxstruts"
extends="json-default">
<action name="autoComplete"
class="ajaxstruts.AutoCompleteCityAction" >
<result type="json">
<param name="root">json</param>
</result>
</action>
</package>
then written as .jsp
<%@ taglib prefix="s" uri="/struts-tags" %>
<%@ taglib prefix="sx" uri="/struts-dojo-tags" %>
<html>
<head>
<sx:head />
</head>
<body>
<div align="center">
<s:label name="City" value="Choose City:" />
<s:url id="cityList" action="autoComplete" method="getCities" />
<sx:autocompleter name="city" href="
"
size="20" />
</div>
</body>
</html>
when i am running
the text box is showing
"message
type
number"
but no auto completion [even after adding autoComplete="true" ]
please look into