kexcKing 发表于 2013-2-6 11:05:58

extjs小结

1.extjs出现中文乱码:
解决方案:
    1).html 文件的charset= gb2312;
    2).将.js用文本编辑器打开,保存为.ansi格式。
问题解决。!! wu wu
 
2. var positionStore = new Ext.data.Store({
       autoLoad:true,
       proxy: new Ext.data.HttpProxy({url: '../action/user/get_positions.jsp'}),
       reader: new Ext.data.ArrayReader({root: ''}, [
           {name: 'level', mapping:0},
           {name: 'name', mapping:1}
       ])
   });
 
var position = new Ext.form.ComboBox({
                    fieldLabel : "职      称",
                    name : "position",
                    id : "position",
                    hiddenName : "positionId",//后台通过hiddenName来作为parameter
                    anchor : "98%",
                    height : 23,
                    mode : "local",
                    store : positionStore,
                    displayField : "name",
                    valueField : "level",
                    typeAhead : true,
                    triggerAction : "all",
                    emptyText : "选择职称...",
                    forceSelection : true,
                    allowBlank : false
        });
   【备注:hiddenName是后台程序同前台的"纽扣",必不可少】
3.Json格式数据生成工具---com.google.gson.Gson
    1)ex: 
        List list = session.createQuery(sql).list();
        Gson gson = new Gson();
        response.getWriter().write(gson.toJson(list));

   密码加密工具-----fi.iki.santtu.md5.MD5
     1) ex:
         user.setUserPassword(new MD5(pwd).asHex());

 
页: [1]
查看完整版本: extjs小结