⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 customeraction.java

📁 该车间信息管理系统
💻 JAVA
字号:
package com.briup.web.action;import java.util.ArrayList;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.briup.bean.LxfWorkshopEmployee;import com.briup.bean.LxfWorkshopProduct;import com.briup.bean.LxfWorkshopRoom;import com.briup.common.exception.MemberServiceException;import com.briup.common.exception.RoomServiceException;import com.briup.common.util.BeanFactory;import com.briup.service.MemberService;import com.briup.service.RoomService;public class CustomerAction extends DispatchAction {	private RoomService roomService = (RoomService) BeanFactory			.getBean("roomService");	private MemberService memberService = (MemberService) BeanFactory			.getBean("memberService");	public ActionForward listRooms(ActionMapping mapping, ActionForm form,			HttpServletRequest request, HttpServletResponse response) {		// TODO Auto-generated method stub		try {			List<LxfWorkshopRoom> list = roomService.listAllRooms();			request.setAttribute("allRooms", list);			return new ActionForward("/pages/ListRooms.jsp");		} catch (RoomServiceException e) {			// TODO Auto-generated catch block			e.printStackTrace();			request.setAttribute("message", e.getMessage());			return new ActionForward("/pages/frame/rightframe.jsp");		}	}	//显示员工列表	public ActionForward listEmployees(ActionMapping mapping, ActionForm form,			HttpServletRequest request, HttpServletResponse response) {		// TODO Auto-generated method stub		try {			List<LxfWorkshopEmployee> list = memberService.listAllMembers();			request.setAttribute("allEmployees", list);			return new ActionForward("/pages/ListEmployee.jsp");		} catch (MemberServiceException e) {			// TODO Auto-generated catch block			e.printStackTrace();			request.setAttribute("message", e.getMessage());			return new ActionForward("/pages/activity.jsp");		}	}	//显示产品列表	public ActionForward listProducts(ActionMapping mapping, ActionForm form,			HttpServletRequest request, HttpServletResponse response) {		// TODO Auto-generated method stub		try {			List<LxfWorkshopProduct> list = memberService.listAllProducts();			request.setAttribute("allProduct", list);			return new ActionForward("/pages/ListProducts.jsp");		} catch (MemberServiceException e) {			// TODO Auto-generated catch block			e.printStackTrace();			request.setAttribute("message", e.getMessage());			return new ActionForward("/pages/activity.jsp");		}	}		public ActionForward findRoom(ActionMapping mapping, ActionForm form,			HttpServletRequest request, HttpServletResponse response) {		// TODO Auto-generated method stub		try {			String roomname = request.getParameter("roomName");			LxfWorkshopRoom room = roomService.findRoomByName(roomname);			List<LxfWorkshopRoom> list = new ArrayList<LxfWorkshopRoom>();			list.add(room);			request.setAttribute("room", list);			return new ActionForward("/pages/Findroom.jsp");		} catch (RoomServiceException e) {			// TODO Auto-generated catch block			e.printStackTrace();			request.setAttribute("message", e.getMessage());			return new ActionForward("/pages/activity.jsp");		}	}	public ActionForward findEmployeeByName(ActionMapping mapping,			ActionForm form, HttpServletRequest request,			HttpServletResponse response) {		// TODO Auto-generated method stub		try {			String name = request.getParameter("ename");			List<LxfWorkshopEmployee> list = memberService					.findEmployeeByName(name);			request.setAttribute("elist", list);			return new ActionForward("/pages/Findemployee.jsp");		} catch (MemberServiceException e) {			// TODO Auto-generated catch block			e.printStackTrace();			request.setAttribute("message", e.getMessage());			return new ActionForward("/pages/activity.jsp");		}	}	public ActionForward findEmployeeByRoomName(ActionMapping mapping,			ActionForm form, HttpServletRequest request,			HttpServletResponse response) {		// TODO Auto-generated method stub		try {			String name = request.getParameter("roomName");			List<LxfWorkshopEmployee> list = memberService					.findEmployeeByRoomName(name);			request.setAttribute("elist", list);			return new ActionForward("/pages/Findemployee.jsp");		} catch (MemberServiceException e) {			// TODO Auto-generated catch block			e.printStackTrace();			request.setAttribute("message", e.getMessage());			return new ActionForward("/pages/activity.jsp");		}	}	public ActionForward findProduct(ActionMapping mapping, ActionForm form,			HttpServletRequest request, HttpServletResponse response) {		// TODO Auto-generated method stub		try {			String name = request.getParameter("pName");			List<LxfWorkshopProduct> list = memberService					.findProductByName(name);			request.setAttribute("pList", list);			return new ActionForward("/pages/Findproduct.jsp");		} catch (MemberServiceException e) {			// TODO Auto-generated catch block			e.printStackTrace();			request.setAttribute("message", e.getMessage());			return new ActionForward("/pages/activity.jsp");		}	}}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -