后台数据:
public String getPersonName(){
HttpServletRequest request = getHttpServletRequest();
String lesseeno = request.getParameter("lesseeNo");
ResourcesDetail resourcesDetail = new ResourcesDetail();
resourcesDetail.setLesseeNo(lesseeno);
String lessName = getiResourceManageService().getPersonName(resourcesDetail);
Map<String,String> map = new HashMap<String, String>();
map.put("name", lessName);
JSONObject json = JSONObject.fromObject(map);
printHttpServletResponse(json.toString());
return null;
}
前台数据:
{
columnWidth : 0.3,
layout : 'form',
labelWidth : 100,
border : false,
items : {
fieldLabel : cf_getRequiredItem('乙方 编号'),
xtype : 'textfield',
id:'lesseeNo',
name : 'lesseeNo',
allowBlank : false,
maxLength : 128,
listeners: {
change: function(field,newValue,oldValue) {
Ext.Ajax.request({
url: 'resourcemanageAction!getPersonName.shtml',
method: 'POST',
params: {lesseeNo: Ext.getCmp('lesseeNo').getValue()}, 编号输入框
success: function(response) {
if(response.responseText != '') {
var e = Ext.util.JSON.decode(response.responseText);
Ext.getCmp('lesseeName').setValue(e.name);
Ext.getCmp('lesseeName').readOnly=true;
} else {
Ext.getCmp('lesseeName').setValue('');
}
}
});
}
}
}
}
EXT 中json格式数据后台与前台的交互
最新推荐文章于 2022-08-23 08:45:00 发布