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

📄 rolegroupadmaction.java

📁 这是一个轻便的j2ee的web应用框架,是一个在多个项目中运用的实际框架,采用struts,hebinate,xml等技术,有丰富的tag,role,navigation,session,dictio
💻 JAVA
字号:
/*
 * Created on 2004-8-24
 *
 */
package com.esimple.service.rbac.action;

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

import org.apache.struts.action.ActionError;
import org.apache.struts.action.ActionErrors;

import com.esimple.framework.util.*;
import com.esimple.framework.web.action.BaseForm;
import com.esimple.framework.web.action.IbatisSupportAction;
import com.esimple.service.rbac.po.RoleGroup;

/**
 * @author steven
 *
 */
public class RoleGroupAdmAction extends IbatisSupportAction {

	/* (non-Javadoc)
	 * @see com.esimple.framework.web.action.BaseAction#execute(com.esimple.framework.web.action.BaseForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
	 */
	public String execute(
		BaseForm form,
		HttpServletRequest request,
		HttpServletResponse response)
		throws Exception {
		String actionType = form.getValueAsString(
			ACTION_CODE,true);
		ActionErrors errors = new ActionErrors();
		
		if(actionType==null)	{
			request.setAttribute("result",
					this.getSqlMapDao().query("rbac.role.getRoleGroups",null)
					);
			return this.FORWARD_SUCCESS;			
		}
			
		RoleGroup group = new RoleGroup();
		BaseFormUtil.copySimpleProperties(group,form,true);
		
		boolean canDo = true;	
		Object getGroup = this.getSqlMapDao().load("rbac.role.getRoleGroup",group);
		
		if(getGroup!=null && actionType.equals("add")){
			errors.add(	ActionErrors.GLOBAL_ERROR,
					new ActionError("error.rbac.role.group.exist"));
			canDo = false;
		}
		
		if(getGroup==null && actionType.equals("del")){
			errors.add(	ActionErrors.GLOBAL_ERROR,
					new ActionError("error.rbac.role.group.notExist"));
			canDo = false;
		}
		
		logger.debug( form.getValue("groupname") );
		if( actionType.equals("add") && canDo ){
			this.getSqlMapDao().insert("rbac.role.addRoleGroup",group);
		}else if( actionType.equals("update") ){
			this.getSqlMapDao().update("rbac.role.updateRoleGroup",group);
		}else if(actionType.equals("del") ){
			this.getSqlMapDao().delete("rbac.role.deleteRoleGroup",group);
		}
		
		saveErrors(request, errors);
		request.setAttribute("result",
				this.getSqlMapDao().query("rbac.role.getRoleGroups",null)
				);
		return this.FORWARD_SUCCESS;
	}

}

⌨️ 快捷键说明

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