JqueryEasyUI datagrid通过struts请求从后台读取数据
附上用户管理jsp代码:
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ include file="/common/include.jsp"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<body>
<h2>CRUD DataGrid</h2>
<p>Double click the row to begin editing.</p>
<table id="dg" title="My Users" style="width:700px;height:250px"
toolbar="#toolbar" pagination="true" idField="id"
rownumbers="true" fitColumns="true" singleSelect="true">
<thead>
<tr>
<th field="loginname" width="50" editor="{type:‘validatebox‘,options:{required:true}}">用户名</th>
<th field="password" width="50" editor="{type:‘validatebox‘,options:{required:true}}">密码</th>
<th field="mobile" width="50" editor="text">电话</th>
<th field="createtime" width="50" editor="{type:‘validatebox‘,options:{validType:‘email‘}}">创建时间</th>
</tr>
</thead>
</table>
<div id="toolbar">
<a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-add" plain="true" onclick="javascript:$(‘#dg‘).edatagrid(‘addRow‘)">New</a>
<a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-remove" plain="true" onclick="javascript:$(‘#dg‘).edatagrid(‘destroyRow‘)">Destroy</a>
<a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-save" plain="true" onclick="javascript:$(‘#dg‘).edatagrid(‘saveRow‘)">Save</a>
<a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-undo" plain="true" onclick="javascript:$(‘#dg‘).edatagrid(‘cancelRow‘)">Cancel</a>
</div>
<script type="text/javascript">
$(function(){
$(‘#dg‘).edatagrid({
url: window.BIZCTX_PATH + ‘/system/userjson/userList.action‘,
saveUrl: ‘save_user.php‘,
updateUrl: ‘update_user.php‘,
destroyUrl: ‘destroy_user.php‘
});
});
</script>
</body>
</html>
include.jsp的代码:
<%@ page language="java" pageEncoding="UTF-8"%>
<%@ page isELIgnored="false" %>
<%@ page import="com.duosen.ocs.constant.WebConstants" %>
<%@ page import="com.duosen.ocs.system.domain.User" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<script type="text/javascript">
window.BIZCTX_PATH = "<%=path%>";
var bizctxpath = "<%=path%>";
</script>
<link rel="stylesheet" type="text/css" href="<%=path%>/easyui/themes/default/easyui.css">
<link rel="stylesheet" type="text/css" href="<%=path%>/easyui/themes/icon.css">
<link rel="stylesheet" type="text/css" href="<%=path%>/easyui/themes/color.css">
<link rel="stylesheet" type="text/css" href="<%=path%>/easyui/demo/demo.css">
<script type="text/javascript" src="<%=path%>/easyui/jquery.min.js"></script>
<link rel="stylesheet" type="text/css" href="<%=path%>/css/common.css" />
<script type="text/javascript" src="<%=path%>/easyui/jquery.easyui.min.js"></script>
<script type="text/javascript" src="<%=path%>/resource/js/fmscookie.js"></script>
<script type="text/javascript" src="<%=path%>/easyui/jquery.edatagrid.js"></script>
以上js都是jqueryEasyUi官方下载。
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。