SSH2增删改查

  • q1_808451
    了解作者
  • 14.7MB
    文件大小
  • rar
    文件格式
  • 0
    收藏次数
  • VIP专享
    资源类型
  • 0
    下载次数
  • 2022-06-15 06:38
    上传日期
这个一个基于SSH2框架开发的一个客户管理系统,实现了客户管理资料的CRUD。是初学者学习的最佳例子。
employee.rar
内容介绍
package com.sqyao.action; import javax.servlet.http.HttpServletRequest; import org.apache.struts2.ServletActionContext; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import com.opensymphony.xwork2.ActionContext; import com.opensymphony.xwork2.ActionSupport; import com.sqyao.bean.Employee; import com.sqyao.bean.Gender; import com.sqyao.service.EmployeeService; @Controller public class EmployeeAction extends ActionSupport { private static final long serialVersionUID = 1L; private Employee emp=new Employee(); public Employee getEmp() { return emp; } public void setEmp(Employee emp) { this.emp = emp; } @Autowired EmployeeService employeeService; //显示所有员工的相关信息 public String list() { ActionContext context = ActionContext.getContext(); HttpServletRequest request =(HttpServletRequest)context.get(ServletActionContext.HTTP_REQUEST); request.setAttribute("employees", this.employeeService.list()); return "listSuccess"; } //添加员工和员工的具体信息 public String save() throws Exception { Employee emps = getEmp(); ActionContext context = ActionContext.getContext(); HttpServletRequest request =(HttpServletRequest)context.get(ServletActionContext.HTTP_REQUEST); String uname=request.getParameter("username"); String upass=request.getParameter("password"); String ugender=request.getParameter("gender"); emps.setUsername(uname); emps.setPassword(upass); if("man".equals(ugender)) emps.setGender(Gender.MAN); else emps.setGender(Gender.WOMEN); this.employeeService.save(emp); return "addSuccess"; } //根据员工的姓名查找员工的具体信息 public String find() { ActionContext context = ActionContext.getContext(); HttpServletRequest request =(HttpServletRequest)context.get(ServletActionContext.HTTP_REQUEST); String uname=request.getParameter("username"); //System.out.println(uname); request.setAttribute("result", this.employeeService.find(uname)); return "findSuccess"; } //根据员工的姓名删除员工的具体信息 public String delete() { Employee emps = getEmp(); ActionContext context = ActionContext.getContext(); HttpServletRequest request =(HttpServletRequest)context.get(ServletActionContext.HTTP_REQUEST); String uname=request.getParameter("username"); emps.setUsername(uname); this.employeeService.delete(new String[]{uname}); return "deleteSuccess"; } public String update() { Employee emps = getEmp(); ActionContext context = ActionContext.getContext(); HttpServletRequest request =(HttpServletRequest)context.get(ServletActionContext.HTTP_REQUEST); String uname=request.getParameter("username"); String upass=request.getParameter("password"); emps.setUsername(uname); emps.setPassword(upass); this.employeeService.update(emps); return "updateSuccess"; } }
评论
    相关推荐
    • ssh源码
      ssh源码
    • sshUbuntu
      sshUbuntu
    • SSH实践
      SSH实践
    • ssh商城源码
      ssh商城源码ssh商城源码ssh商城源码ssh商城源码ssh商城源码ssh商城源码ssh商城源码ssh商城源码ssh商城源码ssh商城源码ssh商城源码ssh商城源码ssh商城源码
    • SSH Checker
      SSH file sample IP(Host)|user|pass|Country IP(Host)|user|pass|Country
    • SSH
      SSH
    • SSH例子
      无法执行对数据库操作的工程
    • ssh activiti
      ssh activiti activiti源码分析
    • SSH
      ssh-chain可以充当ssh的包装,以避免用垃圾填充您的known_hosts文件-只需运行ssh-chain而不是ssh。 简单的用例是这样的: ssh final.example ^ second.example ^ first.example 该连接是从右到左建立的,因此您将...
    • ssh2
      ssh2.....ssh2.....ssh2.....ssh2.....