前台JS代码:
var paraName = Ext.getCmp("Unim_AssTarPar_TXT_paraName").getValue();
if (paraName != null && paraName != 'undefined' && paraName!=g_paraName_ACSF) {
var url_link = __ctxPath + '/unim/isRepeatUnimAssTarPar.do?paraName='+
encodeURIComponent(paraName
);
url_link =
encodeURI(url_link
);
var responsea = Ext.lib.Ajax.getConnectionObject().conn;
responsea.open("POST", url_link, false);
responsea.send(null);
var result = Ext.util.JSON.decode(responsea.responseText);//解析数据
if(result.success==true) {
Ext.Msg.alert("信息提示","该参数名重复,请修改!");
Ext.getCmp("Unim_AssTarPar_TXT_paraName").focus();
return;
}
}
后台Java代码:
public String isRepeat() {
String paraName = getRequest().getParameter("paraName");
try {
if(StringUtils.isNotBlank(paraName)) {
paraName =
URLDecoder.decode(paraName
,"utf-8");
}
} catch (
UnsupportedEncodingException e) {
e.printStackTrace();
}
QueryFilter filter = new QueryFilter(getRequest());
filter.addFilter("Q_paraName_S_EQ", paraName);
List<UnimAssTarPar> list = unimAssTarParService.getAll(filter);
if(list.size()>0) {
setJsonString("{success:true}");
} else {
setJsonString("{success:false}");
}
return SUCCESS;
}