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

📄 leavewordaction.java

📁 中应用程序的访问权限对Java Web Console 中应用程序的访问权限 成功登录 Web 控制台后,可能无法自动访问在该控制台中注册的所有应用程序。通常,必须安装应用程序,才能让所有的用户在控制
💻 JAVA
字号:
package edu.yinhe.mis.control;

import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.beanutils.BeanUtils;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import edu.yinhe.mis.dto.LeaveWordDTO;
import edu.yinhe.mis.vo.LeaveWordVO;
import edu.yinhe.system.common.AppException;
import edu.yinhe.system.control.BaseAction;

public class LeaveWordAction extends BaseAction {
	public ActionForward addLeaveWord(ActionMapping mapping,
			HttpServletRequest request, HttpServletResponse response) {
		LeaveWordDTO dto = new LeaveWordDTO();
		LeaveWordForm form = new LeaveWordForm();
		LeaveWordVO vo = new LeaveWordVO();
		ActionForward forward = mapping.findForward("input");
		
			try {
				BeanUtils.copyProperties(dto, form);
				service.setDataSource(this.getDataSource(request));
				vo =(LeaveWordVO) service.create(dto);	
				forward = mapping.findForward("successLeave");
			} catch (IllegalAccessException e) {
				e.printStackTrace();
			} catch (InvocationTargetException e) {
				e.printStackTrace();
			} catch (AppException e) {
				e.printStackTrace();
			}
			
	
		return forward;
	}
		public ActionForward browseLeaveWord(ActionMapping mapping,
				HttpServletRequest request, HttpServletResponse response){
			LeaveWordDTO dto = new LeaveWordDTO();
			LeaveWordForm form = new LeaveWordForm();
			ArrayList list = new ArrayList();
			ActionForward forward = mapping.findForward("input");
			try {
				service.setDataSource(this.getDataSource(request));
				list =(ArrayList) service.findAll();
			    forward = mapping.findForward("successLeave");
			} catch (AppException e) {
				e.printStackTrace();
			}
			return forward; 
			
		}
		
		public ActionForward deleteLeaveWord(ActionMapping mapping,
				HttpServletRequest request, HttpServletResponse response){
			ActionForward forward = mapping.findForward("input");
			Integer id = Integer.parseInt(request.getParameter("id"));
			try {
				service.setDataSource(this.getDataSource(request));
				service.remove(id);
				forward = mapping.findForward("successLeave");
			} catch (AppException e) {
				e.printStackTrace();
			}
			return forward;
			
		}
		public ActionForward updateLeaveWord(ActionMapping mapping,
				HttpServletRequest request, HttpServletResponse response){
			LeaveWordDTO dto = new LeaveWordDTO();
			LeaveWordForm form = new LeaveWordForm();
			LeaveWordVO vo = new LeaveWordVO();
			ActionForward forward = mapping.findForward("input");
				try {
					BeanUtils.copyProperties(dto, form);
					Integer id = Integer.parseInt(request.getParameter("hfid"));
					dto.setID(id);
					service.setDataSource(this.getDataSource(request));
					service.modify(dto);
				} catch (NumberFormatException e) {
					e.printStackTrace();
				} catch (IllegalAccessException e) {
					e.printStackTrace();
				} catch (InvocationTargetException e) {
					e.printStackTrace();
				} catch (AppException e) {
					e.printStackTrace();
				} 
				return null;

		}
		
		public ActionForward fuhuiLeaveWord(ActionMapping mapping, 
				HttpServletRequest request, HttpServletResponse response){
     			ActionForward forward = mapping.findForward("input");
     			LeaveWordVO vo =new LeaveWordVO(); 
			    Integer id = Integer.parseInt(request.getParameter("id"));
			    try {
					service.setDataSource(this.getDataSource(request));
					vo =(LeaveWordVO) service.list(id);
					if(vo!=null){
						request.setAttribute("leave", vo);
						forward = mapping.findForward("successLeave");
					}
				} catch (AppException e) {
					e.printStackTrace();
				}
				return null;
			
		}
}

⌨️ 快捷键说明

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