1
<%@ page contentType="text/html;charset=UTF-8" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<%@ include file="/common/meta.jsp"%>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>SpringMVC+Hibernate +MySql+ EasyUI ---CRUD</title>
<script type="text/javascript">
function getCookie(c_name){
if (document.cookie.length>0){
c_start=document.cookie.indexOf(c_name + "=");
if (c_start!=-1){
c_start=c_start + c_name.length+1;
c_end=document.cookie.indexOf(";",c_start);
if (c_end==-1) {
c_end=document.cookie.length;
}
return document.cookie.substring(c_start,c_end);
}
}
return "";
}
var pageSize = 20;
var pageNumber = 1;
var sortName = '';
var sortOrder = '';
function initDate(){
var s = getCookie("role");
s = decodeURIComponent(s);
if(s != null && s != ""){
searchMap = eval('(' + s + ')');
pageSize = searchMap.rows;
if(pageSize == null || pageSize == ""){
pageSize = 20;
}
pageNumber = searchMap.pageNumber;
sortName = searchMap.sortName;
sortOrder = searchMap.sortOrder;
$("#name").val(searchMap.name );
}
}
$(function(){
$("#doSearch").click(function(){
doSearch();
});
initDate();
var name=$("#name").val();
$('#dg').datagrid({
url:"${ctx }/user/list",
pagination:true,
singleSelect:true,
pageSize:pageSize,
pageNumber:pageNumber,
sortOrder:sortOrder,
sortName:sortName,
queryParams:{
name:name,
},
width:800,
columns:[[
{field:'name',title:'名称', width:100, align:"center",sortable:true},
{field:'age',title:'年龄', width:50, align:"center",sortable:true},
{field:'address',title:'地址', width:50, align:"center",sortable:true},
{field:'operation',title:'操作', width:340, align:"center", sortable:false,
formatter:function(value,row,index){
var s ="";
s+="<a href=\"javascript:void(0)\"><span onclick=\"javaScript:gotoModify('"+row.id+"');\">修改</span></a>";
s += "|";
s+="<a href=\"javascript:void(0)\"><span onclick=\"javaScript:gotoDel('"+row.id+"');\">删除</span> </a>";
return s;
}
}
]]
});
var p = $('#dg').datagrid('getPager');
$(p).pagination({
pageList: [10,20,50,100]
});
$("#doSearch").click(function(){
doSearch();
});
});
function doSearch(){
var name=$("#name").val();
/* var schoolId=$("#schoolId").val(); */
$("#dg").datagrid('load',{
name:name
}); //重新载入
}
</script>
</head>
<body onload="resizeDg();" onresize="resizeDg();" >
<div class="neirong">
<div class="add-content" style="margin-top:0">
<div class="xinxi2">
<div class="search_box">
<p>名称: <input name="name" id="name" type="text" /></p>
<a href="javascript:void(0);" id="doSearch" class="blank_btn">查询</a></div>
<div class="btn_div">
<a href="javascript:void(0);" onclick="gotoAdd();" id="xtsz_rygl_jsgl_add" class="blank_btn">新增</a>
<a href="javascript:void(0);" id="deletes" class="blank_btn" >批量删除</a>
<a href="javascript:void(0);" id="highchart" onclick="gotoHighchart();" class="blank_btn" >查看图表</a>
</div>
</div>
<div class="contant_list" >
<!-- c_top start-->
<table width="100%">
<tr>
<td>
<table id="dg"></table>
</td>
</tr>
</table>
</div>
</div>
</div>
</body>
</html>
2
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ page contentType="text/html;charset=UTF-8" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<%@ include file="/common/meta.jsp"%>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>修改用户信息</title>
<script type="text/javascript">
function doCancel(){
document.location.href="${ctx }/user/index";
}
$(function(){
$('#form1').form({
onSubmit: function(){
var v = $(this).form('validate');
if(v){
$("#doSubmit").unbind('click');
}
return v;
},
success:function(data){
data = eval('(' + data + ')');
if(data.success == true){
document.location.href="${ctx }/user/index";
}else {
$("#doSubmit").bind("click",function(){
$('#form1').submit();
});
alert(data.msg);
}
}
});
$("#doSubmit").click(function() {
$('#form1').submit();
return false;
});
});
</script>
</head>
<body>
<div class="tables_title">修改用户</div>
<form action="${ctx }/user/modify" id="form1" method="post">
<input type="hidden" name="id" value="${userinfo.id }"></input>
<div class="dengji_table">
<div class="basic_table">
<div class="clospan">
<p class="basic_name">名称</p>
<p>
<input name="name" id="name" type="text" class="easyui-validatebox" data-options="required:true" value="${userinfo.name}"/>
</p>
</div>
</div>
<div class="basic_table">
<div class="clospan">
<p class="basic_name" style=" border-right:none;">年龄</p>
<p>
<input name="age" id="age" type="number" min="18" max="99" class="easyui-validatebox" data-options="required:true" value="${userinfo.age}"/>
</p>
</div>
</div>
<div class="basic_table">
<div class="clospan">
<p class="basic_name" style=" border-right:none;">地址</p>
<p>
<input name="address" id="address" type="text" class="easyui-validatebox" data-options="required:true" value="${userinfo.address}"/>
</p>
</div>
</div>
<div class="clospan_func">
<div class="btns">
<a href="javascript:void(0);" id="doSubmit" class="blank_btn">保存</a>
<a href="javascript:void(0);" onclick="doCancel();" class="blank_btn">返回</a>
</div>
</div>
</div>
</form>
</body>
</html>
3
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ page contentType="text/html;charset=UTF-8" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<%@ include file="/common/meta.jsp"%>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>SpringMVC+Hibernate +MySql+ EasyUI ---CRUD</title>
<script type="text/javascript">
function doCancel(){
document.location.href="${ctx }/user/index";
}
$(function(){
$('#form1').form({
onSubmit: function(){
var v = $(this).form('validate');
if(v){
$("#doSubmit").unbind('click');
}
return v;
},
success:function(data){
data = eval('(' + data + ')');
if(data.success == true){
document.location.href="${ctx }/user/index";
}else {
$("#doSubmit").bind("click",function(){
$('#form1').submit();
});
alert(data.msg);
}
}
});
$("#doSubmit").click(function() {
$('#form1').submit();
return false;
});
});
</script>
</head>
<body>
<div class="tables_title">Add New UserInfo</div>
<form action="${ctx }/user/add " id="form1" method="post">
<div class="dengji_table">
<div class="basic_table">
<div class="clospan">
<p class="basic_name">名称</p>
<p>
<input name="name" id="name" type="text" class="easyui-validatebox" data-options="required:true" placeholder="输入中文"/>
</p>
</div>
</div>
<div class="basic_table">
<div class="clospan">
<p class="basic_name" style=" border-right:none;">年龄</p>
<p>
<input name="age" id="age" type="number" min="18" max="99" class="easyui-validatebox" data-options="required:true" placeholder="年龄不得小于18"/>
</p>
</div>
</div>
<div class="basic_table">
<div class="clospan">
<p class="basic_name" style=" border-right:none;">地址</p>
<p>
<input name="address" id="address" type="text" class="easyui-validatebox" data-options="required:true" placeholder="市区名"/>
</p>
</div>
</div>
<div class="clospan_func">
<div class="btns">
<a href="javascript:void(0);" id="doSubmit" class="blank_btn">保存</a>
<a href="javascript:void(0);" onclick="doCancel();" class="blank_btn">返回</a>
</div>
</div>
</div>
</form>
</body>
</html>
4
5
6