在ExtJs Ajax响应中发送ArrayList

我想将ArrayList作为对象发送到ExtJs ajax响应中,现在,一切正常,除了响应返回为responseText(遇到JavaScript错误)之外,我有试图将List转换为JsonArray,但这也行不通。

public String checkIsHoldingMemberSelected(){
        String result = AppConstants.NO_HOLDING_MEMber_SELECTED;
        JSONObject json = new JSONObject();

        List<account>selectedMemberList=new ArrayList<account>();

        try{
            HttpServletRequest request = ServletactionContext.getRequest();
            HttpSession httpSession = request.getSession();
            if(null != httpSession.getattribute(AppConstants.SEARCH_HOLDING_MEMber_IDS)){
                Set<String> smId = (HashSet<String>)httpSession.getattribute(AppConstants.SEARCH_HOLDING_MEMber_IDS);
                if(!smId.isEmpty()){
                    List<account>holdingMemberList=(List<account>) httpSession.getattribute("memberList");
                    for(String memberId:smId) {
                        int index=getIndex(memberId,holdingMemberList);
                        selectedMemberList.add(holdingMemberList.get(index));
                    }
                }
            }
            JSONArray jsArray = new JSONArray(selectedMemberList);
            json.put("jsArray",jsArray);
            writeJSONData(json);
        }catch(Exception e){
            e.printStackTrace();
        }
        return null;
    }

JavaScript

var amok = new Ext.Button({
        text:'OK',id:'2',handler: function(){
        var loadURL  = "checkisholdingmemberselected.action";
        Ext.Ajax.request({
            form: document.forms['form1'],url:loadURL,success:function(response) {
                var result = Ext.decode(response.responseText);
                addSelectedMembersToHolding(result);
            }
        });

        }
    });

在ExtJs Ajax响应中发送ArrayList

在ExtJs Ajax响应中发送ArrayList

xutuzi 回答:在ExtJs Ajax响应中发送ArrayList

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/2993421.html

大家都在问