赞
踩
使用MyBatis逆向生成员工表和部门表的实体类,接口以及映射文件
pom.xml中添加分页插件的依赖
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper</artifactId>
<version>5.1.2</version>
</dependency>
sqlMapConfig.xml中添加分页插件配置
<!-- 分页插件 -->
<plugins>
<plugin interceptor="com.github.pagehelper.PageInterceptor">
<!-- 3.3.0版本可用 - 分页参数合理化,默认false禁用 -->
<!-- pageNum表示当前页 pages表示尾页 -->
<!-- true启用合理化时,如果pageNum<1会查询第一页,如果pageNum>pages会查询最后一页 -->
<!-- false禁用合理化时,如果pageNum<1或pageNum>pages会返回空数据 -->
<property name="reasonable" value="true"/>
</plugin>
</plugins>
<form id="myForm" action="/emp/search" method="post" style="text-align: center">
姓名:<input type="text" name="name" value="${ec.name}">
工资:<input type="text" name="startSalary" value="${ec.startSalary}" >-
<input type="text" name="endSalary" value="${ec.endSalary}" >
生日:<input type="date" name="startBirth" value="<fmt:formatDate value='${ec.startBirth}' pattern='yyyy-MM-dd'/>" >-
<input type="date" name="endBirth" value="<fmt:formatDate value='${ec.endBirth}' pattern='yyyy-MM-dd'/>" >
部门:<select name="deptid" >
<option value="0">--请选择--</option>
<c:forEach var="dept" items="${depts}">
<option value="${dept.id}"
<c:if test="${dept.id==ec.deptid}">selected=true&
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。