extjs4自动完成:无法访问服务
我使用ExtJS4 我想用combobox做自动完成 这意味着当我在组合框中输入文本时,一个请求将发送到数据库,以便根据组合框中输入的文本显示员工列表(在我的情况下) 在EmployeesModel.js中,我有extjs4自动完成:无法访问服务,extjs4,Extjs4,我使用ExtJS4 我想用combobox做自动完成 这意味着当我在组合框中输入文本时,一个请求将发送到数据库,以便根据组合框中输入的文本显示员工列表(在我的情况下) 在EmployeesModel.js中,我有 Ext.define('GenericComboModel', { extend: 'Ext.data.Model', fields: [ {name: 'label', type: 'string'},
Ext.define('GenericComboModel', {
extend: 'Ext.data.Model',
fields: [
{name: 'label', type: 'string'},
{name: 'value', type: 'string'}
]
});
var employeesStore= Ext.create('Ext.data.Store', {
model: 'GenericComboModel',
proxy: {
type: 'ajax',
url: 'employeesService',
reader: {
type: 'json',
root: 'users'
}
}
});
在employeesview.js中,我有
{
xtype: 'combobox',
store: employeesStore,
displayField: 'label',
valueField: 'value',
queryMode: 'remote',
fieldLabel: 'test',
editable: false,
id: 'employees_IdCombo',
hideTrigger:true
queryParam: 'searchStr'
}
在服务employeesService.java中,我有
public class employeesService{
public List<employees> getEmployeesListByLibelle(String libelle) {
// TODO Auto-generated method stub
Query query = getSession().createQuery("FROM employees emp where emp.libelle=:libelle ");
query.setParameter("libelle", libelle);
List result = query.list();
if(result.size()!=0 && result !=null)
return result;
else
return null;
}
}
我认为服务类应该具有servlet的语法,但我不知道这是否是一个解决方案,也不知道
url:'employeesService'
如何变成employeesService.getEmployeesListByLibelle
?也会返回404吗?
GET http://localhost:8080/employeesService.getEmployeesListByLibelle?_dc=1376728740208&searchStr=testSearch&page=1&start=0&limit=25&filter=%5B%7B%22property%22%3A%22label%22%7D%5D 404 (Introuvable) ext-all-rtl.js:21