roleaction.java

来自「这是一个jbpm的高级应用,是一个oa工作流的系统,里面用到了spring,hi」· Java 代码 · 共 53 行

JAVA
53
字号
package com.bjsxt.oa.web.actions;

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

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

import com.bjsxt.oa.managers.RoleManager;
import com.bjsxt.oa.model.Role;
import com.bjsxt.oa.web.forms.RoleActionForm;

public class RoleAction extends BaseAction {

	private RoleManager roleManager;
	
	@Override
	protected ActionForward unspecified(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
		
		request.setAttribute("pm", roleManager.searchRoles());
		
		return mapping.findForward("index");
	}
	
	public ActionForward addInput(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
		
		
		
		return mapping.findForward("add_input");
	}
	
	public ActionForward add(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
		RoleActionForm raf = (RoleActionForm)form;
		Role role = new Role();
		BeanUtils.copyProperties(role, raf);
		roleManager.addRole(role);
		return mapping.findForward("pub_add_success");
	}
	
	public ActionForward del(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
		RoleActionForm raf = (RoleActionForm)form;
		roleManager.delRole(raf.getId());
		return mapping.findForward("pub_del_success");
	}

	public void setRoleManager(RoleManager roleManager) {
		this.roleManager = roleManager;
	}
	
}

⌨️ 快捷键说明

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