jQuery EasyUI里表单(Form)的load的方法 需要返回什么格式的JSON文件 ,我的返回数据显示不了 有实例的大哥们。
[color=red]HTML:[/color]
function editInfo(){
var row = $('#test').datagrid('getSelected');
if(row){
win.window('open');
var code = row.code;
$('#form1').form('load', 'get.action?code='+code);
}else{
$.messager.alert('提示信息','请先选择要更新的记录。','info');
}
}
<form method="post" id="form1">
<table>
<tr>
<td>企业编号:</td>
<td><input name="qybh" style="width:200px;" id="qybh"></input></td>
</tr>
<tr>
<td>企业名称:</td>
<td><input name="qymc" style="width:200px;"></input></td>
</tr>
<tr>
<td>设备序号 :</td>
<td><input name="sbxh" style="width:200px;"></input></td>
</tr>
<tr>
<td>设备名称:</td>
<td><input name="sbmc" style="width:200px;"></input></td>
</tr>
<tr>
<td>正常率:</td>
<td><input name="zcl" style="width:200px;"></input></td>
</tr>
<tr>
<td>保修率:</td>
<td><input name="bxl" style="width:200px;"></input></td>
</tr>
<tr>
<td>出水/入水:</td>
<td><input name="csrs" style="width:200px;"></input></td>
</tr>
<tr>
<td>类型:</td>
<td><input name="lx" style="width:200px;"></input></td>
</tr>
<tr>
<td>预测比:</td>
<td><input name="ycb" style="width:200px;"></input></td>
</tr>
<tr>
<td>指标类型:</td>
<td><input name="zbfl" style="width:200px;"></input></td>
</tr>
<tr>
<td>指标分类:</td>
<td><input name="zbmx" style="width:200px;"></td>
</tr>
<tr>
<td>去除率:</td>
<td><input name="qcl" style="width:200px;"></input></td>
</tr>
<tr>
<td>指标描述:</td>
<td><input name="zbms" style="width:200px;"></input></td>
</tr>
</table>
</form>
</div>
<div style="text-align:center;padding:5px;">
<a href="javascript:void(0)" onclick="saveUser()" id="btn-save" icon="icon-save">保存</a>
<a href="javascript:void(0)" onclick="closeWindow()" id="btn-cancel" icon="icon-cancel">取消</a>
</div>
[color=red]JAVA文件[/color]
:
package com.struts2.jquery.test;
import java.util.ArrayList;
import java.util.List;
import java.sql.*;
import net.sf.json.JSONArray;
import com.struts2.jquery.vo.User;
public class GetAction extends com.struts2.jquery.common.AbstractJSONAction {
private static final long serialVersionUID = 1L;
private JSONArray get;
private String code;
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String GetInfoAction(){
Statement st=null;
Connection conn=null;
ResultSet rs=null;
List<User> list = new ArrayList<User>();
User user = null;
String dbDrive = "oracle.jdbc.driver.OracleDriver"; //dbDrive;
String conStr = "jdbc:oracle:thin:@192.168.0.95:1521:orcl"; //conStr;
try {
Class.forName(dbDrive);
conn=DriverManager.getConnection(conStr,"epe","epe");
st=conn.createStatement();
String sql = "select * from demo_vip where id = "+code+"";
rs = st.executeQuery(sql);
while(rs.next()){
user = new User();
user.setCode(rs.getInt("id"));
user.setQybh(rs.getString("qybh"));
user.setQymc(rs.getString("qymc"));
user.setSbxh(rs.getString("sbxh"));
user.setSbmc(rs.getString("sbmc"));
user.setZcl(rs.getString("zcl"));
user.setBxl(rs.getString("bxl"));
user.setCsrs(rs.getString("csrs"));
user.setLx(rs.getString("lx"));
user.setYcb(rs.getString("ycb"));
user.setZbfl(rs.getString("zbfl"));
user.setZbmx(rs.getString("zbmx"));
user.setQcl(rs.getString("qcl"));
user.setZbms(rs.getString("zbms"));
list.add(user);
}
get = JSONArray.fromObject(list);
System.out.print(get);
}catch (Exception e) {
e.printStackTrace();
}finally{
try {
rs.close();
st.close();
conn.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
return SUCCESS;
}
public JSONArray getGet() {
return get;
}
public void seGet(JSONArray get) {
this.get = get;
}
}
[color=red]配置:[/color]
class="com.struts2.jquery.test.GetAction" method="GetInfoAction">
get