ajax异步读取后台传递回的下拉选项的值方法(ajax实现异步访问的主要步骤)不要告诉别人

随心笔谈2年前发布 编辑
166 0
🌐 经济型:买域名、轻量云服务器、用途:游戏 网站等 《腾讯云》特点:特价机便宜 适合初学者用 点我优惠购买
🚀 拓展型:买域名、轻量云服务器、用途:游戏 网站等 《阿里云》特点:中档服务器便宜 域名备案事多 点我优惠购买
🛡️ 稳定型:买域名、轻量云服务器、用途:游戏 网站等 《西部数码》 特点:比上两家略贵但是稳定性超好事也少 点我优惠购买


package oa.sys016.oagzxxgl.action;

import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import net.sf.json.JSONArray;

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import cn.com.chx.bo.AppBo;

public class DictsAction extends Action{
private AppBo appBo=null;

@Override
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
// 设置编码
response.setContentType(“application/json;charset=UTF-8”);
response.setCharacterEncoding(“UTF-8”);
PrintWriter out=response.getWriter();

appBo=new AppBo();

try {

// 获取ActionType
String actionType=request.getParameter(“actionType”);

if (actionType !=null && actionType.equals(“jieci”)) { // 查询届次
String jieciJson=getJieciJson();
out.print(jieciJson);
}

} catch (Exception e) {
e.printStackTrace();
} finally {
out.close();
}

return null;
}

private String getJieciJson() {
// 查询届次
List jieciList;
try {
jieciList=appBo.query(“SELECT ID AS CODE,ZH_NAME AS NAME FROM ZH_GZ_INFOX”);

List<Map<String, String>> lists=new ArrayList<Map<String, String>>();

if (jieciList.size() > 0) {
for (int i=0; i < jieciList.size(); i++) {
Map<String, String> maps=new HashMap<String, String>();
maps.put(“code”,
(String) ((HashMap) jieciList.get(i)).get(“CODE”));
maps.put(“name”,
(String) ((HashMap) jieciList.get(i)).get(“NAME”));

lists.add(maps);

}
}
// [

© 版权声明

相关文章