列表页没有数据,急!!!

neverdown2 2014-09-25 04:33:00
请求的action是对的,当前页面就是要显示数据的页面,就是显示不了页面的值
在action中,用debug,能查询出getAll的所有数据,所以真的疯了




顺便把我JSP,列表页的代码发给大家看一下
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/jsp/common.jsp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>员工界面</title>
<script type="text/javascript">
$(document).ready(function(){
//1,声明可能用到的组件
var customerGrid,customerDlg,customerForm,searchForm;
//2,在页面加载完毕后,缓存组件
customerGrid =$("#customerGrid");
customerDlg=$("#customerDlg");
customerForm=$("#customerForm");
searchForm=$("#searchForm");
//3,声明一个命令对象,来管理页面中可能会触发的操作
var cmdObj ={
//添加
create:function(){
//用到同一张表单,用方法对某些字段进行了显示
$("#password").closest("tr").show();
$("#password").validatebox("enableValidation");
//打开添加框时,清除表单里的内容
customerForm.form("clear");
customerDlg.dialog("open");


},

//编辑
edit:function(){
//1获取用户点击的行数据
var rowData = customerGrid.datagrid("getSelected");
//2判断是否选中行
if(!rowData){
$.messager.alert("温馨提示","请先选中一行数据再编辑,谢谢!","info");
return;
}else{

//3显示前对表单进行清空
customerForm.form("clear");
//6编辑密码不需要显示,这里用jquery的hidden方法做隐藏
$("#password").closest("tr").hide();
$("#password").validatebox("disableValidation");

//4打开编辑框
customerDlg.dialog("open");

//5回显数据,也就是要重新加载一次要修改的数据
customerForm.form("load",rowData);

}
},

//删除
remove:function(){
//1获得用户点击后的行数据
var row = customerGrid.datagrid("getSelected");

if (row) {
$.messager.confirm('温馨提示', '您确定要删除这个用户吗?', function (r) {
if (r) {
$.post('customer_delete', { id: row.id }, function (result) {
if (result.success) {

customerGrid.datagrid('reload');
}
});
}
});


} else if(!row){
$.messager.alert("温馨提示","请先选择一行再删除,谢谢!","info");


}

},

//刷新
refresh:function(){
customerGrid.datagrid("reload");
},

//添加用户时的保存
save:function(){
customerForm.form('submit', {
url:'customer_save',
onSubmit: function(){
// do some check
// return false to prevent submit;
},
success:function(data){
var rs = eval("("+data+")");
if(rs.success){

//关闭对话框
customerDlg.dialog("close");
$.messager.alert("温馨提示",rs.message,"info",function(){
//重新查询一遍数据
customerGrid.datagrid("reload");
});

}
}
});


},

//高级查询
search:function(){
//1把后台的查询对象,转成json,原代码在common.js中
var paramObj = searchForm.serializeJSON();
alert(paramObj);
//2使用表格加载数据
customerGrid.datagrid("load",paramObj);

},

//添加用户时的取消
cancel:function(){
customerDlg.dialog("close");
}


};
//4统一对增、删、改、查绑定事件
$("a[data-cmd]").bind("click",function(){
//console.debug($(this).data("cmd"));
var cmd = $(this).data("cmd");
/**
这里的意思其实就和下面意思一样,只是采用的更简单的方法
if(cmd=="delete"){
cmdObj.create();
}
*/
if(cmd){
cmdObj[cmd]();
}
});


});



</script>
</head>
<body>
<table id="customerGrid" title="客户列表" class="easyui-datagrid"
fit="true"
url="customer_list.action"
toolbar="#customerToolbar"
pagination="true"
fitColumns="true"
rownumbers="true"
singleSelect="true"
sortOrder="id"
showHeader="true"
showFooter="true"
loadMsg="please wait"
checkOnSelect="true"
pageList="[2,5,10,20,50]" >
<thead>
<tr>

<th data-options="field:'name',width:100">客户姓名</th>
<th data-options="field:'gender',width:100">姓别</th>
<th data-options="field:'age',width:100">年龄</th>
<th data-options="field:'telephone',width:100">电话</th>
<th data-options="field:'address',width:100">地址</th>
<th data-options="field:'email',width:100">电子邮件</th>
<th data-options="field:'qq',width:100">QQ</th>
<th data-options="field:'weChat',width:100">微信</th>
<th data-options="field:'career',width:100">职业</th>
<th data-options="field:'haveHouese',width:100">是否购房</th>
<th data-options="field:'source',width:100">客户来源</th>
<th data-options="field:'seller',width:100">跟进营销人员</th>
</tr>
</thead>
</table>
<div>
<!-- 数据表格菜单项 -->
<div id="customerToolbar">
<a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-add" plain="true" data-cmd="create" >添加</a>
<a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-edit" plain="true" data-cmd="edit">编辑</a>
<a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-remove" plain="true" data-cmd="remove">删除</a>
<a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-reload" plain="true" data-cmd="refresh">刷新</a>

<div>
<form id="searchForm" method="post">
关键字:<input type="text" name="query.searchKey">
最后登陆时间: <input class="easyui-datebox" style="width:80px" name="query.lastLoginTime1">
到: <input class="easyui-datebox" style="width:80px" name="query.lastLoginTime2">

<a href="#" class="easyui-linkbutton" iconCls="icon-search" data-cmd="search">查询</a>
</form>
</div>
</div>
</div>
<!-- 添加对话框架 -->
<div id="customerDlg" class="easyui-dialog" title="添加客户" data-options="iconCls:'icon-save'"
modal="true";
closed="true"
buttons="#customerDlg_btn"
style="width:265px;height:230px;padding:10px;" >

<form id="customerForm" method="post">
<input type="hidden" name="id">
<table >

<tr>
<td>昵称:</td>
<td><input name="nickname" type="text" class="easyui-validatebox" data-options="required:true,validType:'length[2,10]'" ></td>
</tr>

<tr >
<td>用户名:</td>
<td><input name="username" type="text" class="easyui-validatebox" data-options="required:true,validType:'length[2,10]'"></td>
</tr>
<tr>
<td>密码:</td>
<td><input id="password" name="password" type="password" class="easyui-validatebox" data-options="required:true,validType:'length[6,12]'"></td>
</tr>
<tr>
<td>电话:</td>
<td><input name="telphone" type="text" class="easyui-validatebox" data-options="required:true,validType:'length[11,11]'"></td>
</tr>
<tr>
<td>email:</td>
<td><input name="email" type="text" class="easyui-validatebox" data-options="required:true,validType:'email'"></td>
</tr>
</table>
</form>
</div>



<!-- 保存和取消 -->
<div id="customerDlg_btn">
<a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-ok" data-cmd="save">保存</a>
<a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-cancel" data-cmd="cancel">取消</a>
</div>

</body>
</html>
...全文
636 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
_醉逍遥 2014-09-26
  • 打赏
  • 举报
回复
看请求返回的json数据格式是否符合easyui datagrid要求
neverdown2 2014-09-25
  • 打赏
  • 举报
回复
怎么打啊,美女, <thead> <tr> <th data-options="field:'id',width:100">客户编写</th> <th data-options="field:'name',width:100">客户姓名</th> <th data-options="field:'gender',width:100">姓别</th> <th data-options="field:'age',width:100">年龄</th> <th data-options="field:'telephone',width:100">电话</th> <th data-options="field:'address',width:100">住址</th> <th data-options="field:'email',width:100">电子邮件</th> <th data-options="field:'qq',width:100">QQ</th> <th data-options="field:'weChat',width:100">微信</th> <th data-options="field:'career',width:100">职业</th> <th data-options="field:'haveHouese',width:100">是否购房</th> <th data-options="field:'source',width:100">客户来源</th> <th data-options="field:'seller',width:100">跟进销售人员</th> </tr> </thead>
mlkakon 2014-09-25
  • 打赏
  • 举报
回复
试下在jsp 上直接把数据打印出来吧
neverdown2 2014-09-25
  • 打赏
  • 举报
回复
没有问题的。。。
白开水MD5 2014-09-25
  • 打赏
  • 举报
回复
后台数据格式有没有问题?

67,512

社区成员

发帖
与我相关
我的任务
社区描述
J2EE只是Java企业应用。我们需要一个跨J2SE/WEB/EJB的微容器,保护我们的业务核心组件(中间件),以延续它的生命力,而不是依赖J2SE/J2EE版本。
社区管理员
  • Java EE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧