//Created by MyEclipse Struts
// XSL source (default): platform:/plugin/com.genuitec.eclipse.cross.easystruts.eclipse_4.1.1/xslt/JavaClass.xsl
package com.struts.action.empdept;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.io.UnsupportedEncodingException;
import java.text.DateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.actions.DispatchAction;
import com.empdept.employee.EmployeeDAO;
import com.empdept.employee.EmployeeHbn;
import com.global.CalendarConvert;
import com.global.Constants;
import com.global.TableInfo;
import com.hibernate.pojo.Employee;
import com.hibernate.pojo.Instantcommunicateuserinfo;
import com.instantcommunicate.InstantCommunicateUserInfoDAO;
import com.instantcommunicate.InstantCommunicateUserInfoImp;
import com.struts.form.empdept.EmpForm;
/**
* MyEclipse Struts Creation date: 08-12-2006
*
* XDoclet definition:
*
* @struts.action path="/emp" name="empForm" input="/form/emp.jsp"
* parameter="method" scope="request"
*/
public class EmpAction extends DispatchAction {
private int startRecord = 0;// 利用Hibernate从第几条开始分页
private static EmployeeDAO emp = new EmployeeHbn();
private String empCode;
private String empName;
private String empSex;
private String empJoindate;
private String empBirth;
private String empAddress;
private String empEmail;
private String empPhone;
private int currentPage = 1;
private HashMap hashMap;
private List list;
private int recordCount;// 查询到的记录的数量
private String empPwd;
private String empDescription;
private Integer deptId;
private PrintWriter out;
private Integer empId;
/**
* 这是一个按多条件查询的方法
*
* @param mapping
* @param form
* @param request
* @param response
* @return
*/
public ActionForward queryEmp(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
System.out.println("sdfs");
EmpForm empForm = (EmpForm) form;
/*
* 如果是queryEmp.jsp页面提交过来的查询条件放到executeQueryEmpSubmit(request,
* empForm)方法中处理 方法中将查询的条件信息保存到HashMap中,以备下次从empQueryResult.jsp提交过来的查询用
*/
executeQueryEmpSubmit(request, empForm);
/*
* 如果是从页面empQueryResult.jsp提交过来的各种数据
* 则将数据传到executeEmpQueryResultSubmit(request)方法中处理
*/
executeEmpQueryResultSubmit(request);
/* 执行查询 */
list = emp.query(empCode, empName, empSex, CalendarConvert
.toDate(empJoindate), CalendarConvert.toDate(empBirth),
empAddress, empEmail, empPhone, startRecord);
if (list == null || list.size() == 0)
list = null;
// 得到记录总数
recordCount = (Integer) TableInfo.getSaveRecordCountInstance().get(
"EmployeeByQBE");
// System.out.println("总记录数:" + recordCount);
// 得到总页数,保存
request.setAttribute("TotalPage", this.getTotalPage());
// 将总的记录数保存到request中
request.setAttribute("RecordCount", recordCount);
// 将当前是在第几页保存在request中
request.setAttribute("CurrentPage", currentPage);
/* 转发到结果页面显示 */
request.setAttribute("emps", list);
return mapping.findForward("empQueryResult");
}
/**
* 如果是从页面empQueryResult.jsp提交过来的各种数据 则将数据传到该方法中处理
*
* @param request
*/
/**
* @param request
*/
private void executeEmpQueryResultSubmit(HttpServletRequest request) {
if (request.getParameter("empQueryResult") != null
&& request.getParameter("empQueryResult").equals(
"empQueryResult")) {
empCode = hashMap.get("empCode").toString();
empName = hashMap.get("empName").toString();
empSex = hashMap.get("empSex").toString();
if (hashMap.get("empJoindate") != null
&& hashMap.get("empJoindate").toString().trim().length() > 0) {
empJoindate = hashMap.get("empJoindate").toString();
} else {
empJoindate = null;
}
if (hashMap.get("empBirth") != null
&& hashMap.get("empBirth").toString().trim().length() > 0) {
empBirth = hashMap.get("empBirth").toString();
} else {
empBirth = null;
}
empAddress = hashMap.get("empAddress").toString();
empEmail = hashMap.get("empEmail").toString();
next(request);// 跳到下一页
privious(request);// 执行上一页查询
request.setAttribute("hashMap", hashMap);// 再次将查询条件保存到hashMap中,以备下次查询
}
}
/**
* 得到总页数
*/
public int getTotalPage() {
int result = recordCount / Constants.PAGE_RECORD_SHOW_COUNT;
if ((recordCount % Constants.PAGE_RECORD_SHOW_COUNT) > 0)
result = result + 1;
return result;
}
/**
* 执行上一页查询的方法
*
* @param request
*/
private void privious(HttpServletRequest request) {
if ((request.getParameter("previous") != null)
&& (request.getParameter("previous").equals("previous"))) {
startRecord = startRecord - Constants.PAGE_RECORD_SHOW_COUNT;
if (startRecord < 0)
startRecord = 0;
currentPage = currentPage - 1;
if (currentPage <= 1) {
currentPage = 1;
}
}
}
/**
* 执行下一页的查询
*
* @param request
*/
private void next(HttpServletRequest request) {
if ((request.getParameter("next") != null)
&& (request.getParameter("next").equals("next"))) {
startRecord = startRecord + Constants.PAGE_RECORD_SHOW_COUNT;
if (startRecord > recordCount)
startRecord = startRecord - Constants.PAGE_RECORD_SHOW_COUNT;
currentPage = currentPage + 1;
if (currentPage > this.getTotalPage()) {
currentPage = this.getTotalPage();
}
}
}
/**
* 如果是queryEmp.jsp页面提交过来的查询条件放到该方法中处理
* 方法中将查询的条件信息保存到HashMap中,以备下次从empQueryResult.jsp提交过来的查询用
*
* @param request
* @param empForm
*/
private void executeQueryEmpSubmit(HttpServletRequest request,
EmpForm empForm) {
if (request.getParameter("jspPage") != null
&& request.getParameter("jspPage").equals("queryEmp")) {
hashMap = new HashMap();
empCode = empForm.getEmpCode();
empName = empForm.getEmpName();
empSex = empForm.getEmpSex();
if (empForm.getEmpJoindate() == null
|| empForm.getEmpJoindate().trim() == "")
empJoindate = null;
else
empJoindate = empForm.getEmpJoindate().trim();
if (empForm.getEmpBirth() == null || empForm.getEmpBirth() == "")
empBirth = null;
else
empBirth = empForm.getEmpBirth().trim();
empAddress = empForm.getEmpAddress();
empEmail = empForm.getEmpEmail();
empPhone = empForm.getEmpPhone();
// System.out.println("executeQueryEmpSubmit方法中:" + "empCode:"
// + empCode + "|" + "empName:" + empName + "|" + "empSex:"
// + empSex + "|" + "empJoindate:" + empJoindate + "|"
// + "empBirth:" + empBirth + "|" + "empAddress:" + empAddress
// + "|" + "empEmail:" + empEmail + "|" + "empPhone:"
// + empPhone + "|" + "startRecord:" + startRecord);
/* 将上面的查询条件保存起来 */
hashMap.put("empCode", empCode);
hashMap.put("empName", empName);
hashMap.put("empSex", empSex);
hashMap.put("empJoindate", empJoindate);
hashMap.put("empBirth", empBirth);
hashMap.put("empAddress", empAddress);
hashMap.put("empEmail", empEmail);
hashMap.put("empPhone", empPhone);
startRecord = 0;// 第一次提交查询信息过来将查询的开始页面数置0
recordCount = 0;// 初始化
currentPage = 1;// 初始化
request.setAttribute("hashMap", hashMap);
}
}
/**
* 添加员工
*
* @param mapping
* @param form
* @param request
* @param response
* @return
*/
public ActionForward addEmp(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
EmpForm empForm = (EmpForm) form;
empCode = empForm.getEmpCode();
没有合适的资源?快使用搜索试试~ 我知道了~
基于Java、mysql的OA办公系统课设或者毕业设计
共578个文件
java:159个
gif:119个
bmp:98个
4星 · 超过85%的资源 需积分: 19 61 下载量 27 浏览量
2017-07-15
21:03:06
上传
评论 6
收藏 5.63MB ZIP 举报
温馨提示
代码放在java目录下,然后将dboa.sql导入MySQL,管理员为admin,密码为admin,主程序为“daima\num_07\PandaStarOA\WebRoot\login.jsp”。MySQL需要导入的开发包在“daima\num_07\PandaStarOA\WebRoot\WEB-INF\lib”目录下。Hibernate需要导入的开发包也在“daima\num_07\PandaStarOA\WebRoot\WEB-INF\lib”目录下。
资源推荐
资源详情
资源评论
收起资源包目录
基于Java、mysql的OA办公系统课设或者毕业设计 (578个子文件)
struts-config.xml.bak 17KB
CalendarConvert.java.bak 5KB
background7.bmp 791KB
background.bmp 196KB
background2.bmp 114KB
on14.bmp 5KB
on13.bmp 5KB
on2.bmp 5KB
on10.bmp 5KB
on18.bmp 5KB
on15.bmp 5KB
on12.bmp 5KB
on19.bmp 5KB
on9.bmp 5KB
on1.bmp 5KB
on16.bmp 5KB
on8.bmp 5KB
on3.bmp 5KB
on5.bmp 5KB
on20.bmp 5KB
on17.bmp 5KB
on7.bmp 5KB
on4.bmp 5KB
on11.bmp 5KB
on6.bmp 5KB
1.bmp 5KB
query_down.bmp 3KB
query_over.bmp 3KB
up.bmp 3KB
exit.bmp 3KB
down.bmp 3KB
dn9.bmp 3KB
dn20.bmp 3KB
dn12.bmp 3KB
dn11.bmp 3KB
dn4.bmp 3KB
dn14.bmp 3KB
dn10.bmp 3KB
dn19.bmp 3KB
dn2.bmp 3KB
dn6.bmp 3KB
dn18.bmp 3KB
dn13.bmp 3KB
dn5.bmp 3KB
dn15.bmp 3KB
dn17.bmp 3KB
dn16.bmp 3KB
dn7.bmp 3KB
dn8.bmp 3KB
dn1.bmp 3KB
dn3.bmp 3KB
add_over.bmp 3KB
add_down.bmp 3KB
search_down.bmp 3KB
search_over.bmp 3KB
exit2.bmp 2KB
m_dn2.bmp 1KB
m_dn19.bmp 1KB
m_dn12.bmp 1KB
m_dn9.bmp 1KB
m_dn3.bmp 1KB
m_dn14.bmp 1KB
m_dn16.bmp 1KB
m_dn15.bmp 1KB
m_dn7.bmp 1KB
m_dn5.bmp 1KB
m_dn4.bmp 1KB
m_dn10.bmp 1KB
m_dn20.bmp 1KB
m_dn6.bmp 1KB
m_dn11.bmp 1KB
m_dn1.bmp 1KB
m_dn17.bmp 1KB
m_dn18.bmp 1KB
m_dn8.bmp 1KB
m_dn13.bmp 1KB
m_on7.bmp 1KB
m_on9.bmp 1KB
m_on3.bmp 1KB
m_on11.bmp 1KB
m_on15.bmp 1KB
m_on6.bmp 1KB
m_on20.bmp 1KB
m_on2.bmp 1KB
m_on18.bmp 1KB
m_on4.bmp 1KB
m_on13.bmp 1KB
m_on10.bmp 1KB
m_on5.bmp 1KB
m_on8.bmp 1KB
m_on1.bmp 1KB
m_on19.bmp 1KB
m_on17.bmp 1KB
m_on12.bmp 1KB
m_on16.bmp 1KB
m_on14.bmp 1KB
a1.bmp 1KB
ArrowTop.bmp 752B
ArrowDown.bmp 744B
a2.bmp 488B
共 578 条
- 1
- 2
- 3
- 4
- 5
- 6
资源评论
- king_whq2018-05-18可以,感觉可以参考学习下
这个其实也很简单
- 粉丝: 6
- 资源: 16
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功