ssm整合3.easyui

<link rel="stylesheet" type="text/css" href="easyui/themes/default/easyui.css">   
	<link rel="stylesheet" type="text/css" href="easyui/themes/icon.css"> 
	<script type="text/javascript" src="easyui/jquery-1.8.3.min.js"></script>   
	<script type="text/javascript" src="easyui/jquery.easyui.min.js"></script>
<!--需要在head里面添加easyui的引用-->
<body>
    数据条数:${size }
    <table id="dg" class="easyui-datagrid" toolbar="#tb"
		fitColumns="true" rownumbers="true" pagination="true" 
       title="员工列表" style="width:700px;height:250px"
	data-options="singleSelect:true,collapsible:true,
	url:'emp.json',method:'get'">
    <thead>
    	<tr>
    		<th data-options="field:'empno',width:180">编号</td>
    		<th data-options="field:'ename',width:120">姓名</td>
    		<th data-options="field:'sal',width:180">工资</td>
    		<th data-options="width:200">操&nbsp;&nbsp;作</th>
    	</tr></thead>
    </table>
  </body>
		fitColumns="true" rownumbers="true" pagination="true" 
       title="员工列表" style="width:700px;height:250px"
	data-options="singleSelect:true,collapsible:true,
	url:'emp.json',method:'get'">
    <thead>
    	<tr>
    		<th data-options="field:'empno',width:180">编号</td>
    		<th data-options="field:'ename',width:120">姓名</td>
    		<th data-options="field:'sal',width:180">工资</td>
    		<th data-options="width:200">操&nbsp;&nbsp;作</th>
    	</tr></thead>
    </table>
  </body>
<!--注意field是对应json的数据-->
//控制器代码
 
@RequestMapping("/json") @ResponseBody public List<Emp> getEmps(){ List<Emp>empList=service.getList(); return empList; }

 

 

 

 

 

不使用json格式,自己写循环操作。

 

<table class="easyui-datagrid" title="Basic DataGrid" style="width:700px;height:250px"
   data-options="method:'get',singleSelect:true">
		<thead>
			<tr>
				<th data-options="field:'t1',width:80">编号</th>
				<th data-options="field:'t2',width:100">产品</th>
				<th data-options="field:'t3',width:80,align:'right'">价格</th>
				<th data-options="field:'t4'">操作</th>
			</tr>
		</thead>
		<!-- 写循环; -->
		 <c:forEach items="${list }" var="emp">
    	<tr>
    		<td>${emp.empno }</td>
    		<td>${emp.ename }</td>
    		<td>${emp.sal }</td>
    		<td>
    			<a href='emp/toAddEmp'>增加</a>
    			<a href='emp/getEmp/${emp.empno}'>编辑</a>
    			<a href='emp/${emp.empno}/deleteEmp'>删除</a>
    			<a href='emp/deleteEmp2?empno=${emp.empno}'>删除2</a>
    		</td>
    	</tr>
    	</c:forEach>
	</table>

 

 

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

teayear

读后有收获可以获取更多资源

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值