Struts dojo auto completer
--------------------------
Key: WW-3378
URL: https://issues.apache.org/struts/browse/WW-3378
Project: Struts 2
Issue Type: Bug
Components: Plugin - Dojo Tags
Affects Versions: 2.1.8
Environment: windows mysql ie 7
Reporter: nandagopal
Assignee: Ian Roughley
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 () {
return json;
}
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) {
json.put(""+city.getCityId(),city.getCityName()+","+city.getStateName());
}
}
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="{%cityList}"
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
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.