在使用EasyUi的时候,注意两个方面,一就是修改charset--utf-8,二是request的路径要写对.
下面附上一段代码,详细解读一下.
<%@ page contentType="text/html; charset=UTF-8"%>//改成utf-8
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html >
<head>
<title>班级管理</title>
<link rel="stylesheet" href="/TRAMS/css/easyui_old.css" type="text/css" id="indexcssfile2"/>
<script type="text/javascript" src="<%=request.getContextPath()%>/js/jquery.min.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/js/jquery.easyui.min.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/js/easyui-lang-zh_CN.js"></script>
</head>
<body>
<table class="easyui-datagrid"
data-options="singleSelect:true,collapsible:true,url:'<%=request.getContextPath()%>/student?operateFlag=init',//取到的路径为当前用到的具体路径
method:'get',fit:true,pagination://设置true将在数据表格底部显示分页工具栏。true,pageSize:5//页面大小,striped:true,//交替显示行背景pageList:[2,5,10]//页面显示的数据数量">
<thead>
<tr>
<th data-options="field:'id',width:'10%'">学号</th>//field指表字段名
<th data-options="field:'name',width:'10%'">姓名</th>
<th data-options="field:'sex',width:'10%',align:'right'">性别</th>
<th data-options="field:'age',width:'10%',align:'right'">年龄</th>
<th data-options="field:'begindate',width:'10%'">生日</th>
<th data-options="field:'score',width:'10%'">成绩</th>
<th data-options="field:'phone',width:'10%',align:'right'">电话</th>
<th data-options="field:'email',width:'10%'">邮箱</th>
<th data-options="field:'address',width:'10%'">地址</th>
<th data-options="field:'note',width:'10%',align:'right'">描述</th>
</tr>
</thead>
</table>
</body>
</html>