日期:2014-05-20 浏览次数:20706 次
var classStore=new Ext.data.Store({ autoLoad:true, proxy:new Ext.data.HttpProxy({ url:'learner/loadAllClass.action' }), reader:new Ext.data.JsonReader({ root:'classList', fields:['className'] }) }); classStore.load();
var className=new Ext.form.ComboBox({ id:'', fieldLabel:'所属团体', mode:'local', name:'person.groupName', hiddenName:'person.groupName', triggerAction:'all', //loadingText:'正在加载团体信息,请稍候...', store:classStore, valueField:'className', displayField:'className', forceSelection:true, editable:false })
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.1//EN" "struts-2.1.dtd" > <struts> <package name="learner-package" namespace="/learner" extends="json-default"> <action name="load" class="learnerAction" method="load"> <result type="json"> <param name="includeProperties">{learnerList,totalRecords}</param> </result> </action> <action name="uploadExcel" class="learnerAction" method="upload"> <interceptor-ref name="fileUploadStack"/> <result type="json"> <param name="root">result</param> <param name="contentType">text/html</param> </result> </action> <action name="saveOne" class="learnerAction" method="saveOne"> <result type="json"> <param name="root">result</param> </result> </action> <action name="deletes" class="learnerAction" method="deletes"> <result type="json"> <param name="root">result</param> </result> </action> <action name="loadAllClass" class="learnerAction" method="loadAllClass"> <result type="json"> <param name="root">classList</param> <param name="includeProperties">className</param> </result> </action> </package> </struts>
public List getAllClass() throws DAOException{ try{ String queryString="from LearnerClass"; return this.getHibernateTemplate().find(queryString); } catch(Exception ex){ throw new DAOException(ex); } } public class LearnerClass implements java.io.Serializable { // Fields private String className; private String classDesc; private String classAddress; private String classPerson; private Long classTel; // Constructors /** default constructor */ public LearnerClass() { } /** full constructor */ public LearnerClass(String className, String classDesc, String classAddress, String classPerson, Long classTel) { this.className = className; this.classDesc = classDesc; this.classAddress = classAddress; this.classPerson = classPerson; this.classTel = classTel; } // Property accessors public String getClassName() { return this.className; } public void setClassName(String className) { this.className = className; } public String getClassDesc() { return this.classDesc; } public void setClassDesc(String classDesc) { this.classDesc = classDesc; } public String getClassAddress() { return this.classAddress; } public void setClassAddress(String classAddress) { this.classAddress = classAddress; } public String getClassPerson() { return this.classPerson; } public void setClassPerson(String classPerson) { this.classPerson = classPerson; } public Long getClassTel() { return this.classTel; } public void setClassTel(Long classTel) { this.classTel = classTel; } }