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

📄 rolemanageedittag.java

📁 本代码是一个权限管理系统源代码
💻 JAVA
字号:
/**
 * 
 */
package com.seavision.PermissionManage.tag;

import java.util.ArrayList;
import java.util.List;

import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.TagSupport;

import com.seavision.PermissionManage.common.BaseTag;
import com.seavision.PermissionManage.components.FunctionManage;
import com.seavision.PermissionManage.components.RoleManage;
import com.seavision.PermissionManage.help.DaoFectory;
import com.seavision.PermissionManage.vo.FunctionVO;
import com.seavision.PermissionManage.vo.RoleAndFunctionVO;
import com.seavision.PermissionManage.vo.RoleVO;

/**
 * @author qiao rong
 * @date 2007-05-10
 * @param String
 *            roleId
 * @function 角色编辑tag 根据roleId得到此角色记录,打印相应信息 循环打印角色列表
 * 
 */
public class RoleManageEditTag extends BaseTag {

	public int doStartTag() throws JspException {
		this.initializeTag("RoleManageEditTag"); // 初始化类

//		try {
			this.appendMessage("<root>");

			FunctionVO functionVO = null; // 功能点vo,从list取数据时暂存
			List list_func = null; // 功能点列表
			List list_role_page = null;
			RoleVO roleVO = null; // 角色vo
			RoleAndFunctionVO roleAndFunctionVO = null;
			String roleId = null; // 角色Id
			List list = new ArrayList();

			// 组件
			FunctionManage functionManage = DaoFectory.getFunctionManage();
			RoleManage roleManage = DaoFectory.getRoleManage();

			roleId = this.getParameter("roleId"); // 接收角色ID,页面传来
			roleVO = (RoleVO) this.requestGetAttribute("role");
			roleVO = roleManage.getRole(roleId);
			this.appendMessage("<roleId>" + roleId + "</roleId>"); // 角色编号
			this.appendMessage("<roleName>" + roleVO.getRoleName()
					+ "</roleName>");// 角色名称
			this.appendMessage("<roleNumber>" + roleVO.getRoleNumber()
					+ "</roleNumber>");// 角色序号

			// 测试附初值
			// list_func = (List)this.requestGetAttribute("list_role0");

			// 循环打印功能列表
			list_func = functionManage.getFunctionNameList(); //
			list = functionManage.getFunctionName();
			this.appendMessage("<functionList>");
			for (int i = 0; i < list_func.size(); i++) {
				functionVO = (FunctionVO) list_func.get(i);
				this.appendMessage("<function>");
				this.appendMessage("<functionId>" + functionVO.getFunctionName()+ "</functionId>");// 功能编号
				this.appendMessage("<functionName>"+ functionVO.getFunctionName() + "</functionName>"); // 功能名称
				this.appendMessage("</function>");
			}
			this.appendMessage("</functionList>");

			// 循环打印功能列表,这里的功能点是该角色已经拥有的角色。在页面上显示应该是已选中的
			list_role_page = roleManage.getRoleOfFunction(Integer
					.parseInt(roleId)); //
			this.appendMessage("<functionList_selected>");
			for (int i = 0; i < list_role_page.size(); i++) {
				roleAndFunctionVO = (RoleAndFunctionVO)list_role_page.get(i);
				System.out.println("roleAndFunctionVO.getFunctionName()========="+roleAndFunctionVO.getFunctionName());
				this.appendMessage("<functionId_selected>"+ roleAndFunctionVO.getFunctionName()+ "</functionId_selected>");// 功能编号
			}
			this.appendMessage("</functionList_selected>");

			this.appendMessage("</root>");

			this.outputMessage();
//		} catch (Exception ex) {
//			// this.outputStandardErrorMessage();
//			ex.printStackTrace();
//			print("Tag出现异常");
//
//		} // end catch

		return TagSupport.EVAL_BODY_INCLUDE; // 继续计算BODY体
	} // end doStartTag method

	public int doEndTag() throws JspException {
		return EVAL_PAGE;
	}// doEndTag method
}

⌨️ 快捷键说明

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