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

📄 roleaction.java

📁 本源码为教学管理信息系统
💻 JAVA
字号:
package com.wygl.xtgl.action;import java.util.Calendar;import java.util.List;import com.hibernate.action.AbstractAction;import com.opensymphony.xwork.util.XWorkList;import com.wygl.xtgl.domain.Role;import com.wygl.xtgl.service.SysDao;/** * @author Administrator * *  * Window - Preferences - Java - Code Style - Code Templates */public class RoleAction extends AbstractAction {	private SysDao          sysDao;	private List roles ;	private Role role ;	private int  selectedRole;	private List    selectedRoles=new XWorkList(String.class);    private String selectId;	public String add() throws Exception {					sysDao=(SysDao)getServiceBean("sysDao");					if(role.getName().equals("")){			this.addActionError("请为权限组设定正确的名称!");			return "error";		}		role.setTimeOfCreation( Calendar.getInstance());		sysDao.saveRole(role);			return "add";	}	public String delete() throws Exception {		try {				sysDao=(SysDao)getServiceBean("sysDao");					sysDao.deleteRole(selectedRoles);		} catch (RuntimeException e) {			e.printStackTrace();			return ERROR;		}		return "add";	}	public String select() throws Exception {		List roles = (List) get("roles");		if (roles == null) {			return ERROR;		}		else {			role = (Role) roles.get(selectedRole);			set("role", role);			return "select";		}	}	public String list() throws Exception {				sysDao=(SysDao)getServiceBean("sysDao");				roles = (List)sysDao.searchAllRoles();		set("roles",roles);		return "list";	}	public Role getRole() {		if(role==null){			role= new Role();		}		return role;	}	public void setRole(Role role) {		this.role = role;	}	public SysDao getSysDao() {		return sysDao;	}	public void setSysDao(SysDao sysDao) {		this.sysDao = sysDao;	}	public List getRoles() {		return roles;	}	public void setRoles(List roles) {		this.roles = roles;	}	public List getSelectedRoles() {		return selectedRoles;	}	public void setSelectedRoles(List selectedRoles) {		this.selectedRoles = selectedRoles;	}	public String getSelectId() {		return selectId;	}	public void setSelectId(String selectId) {		this.selectId = selectId;	}	public int getSelectedRole() {		return selectedRole;	}	public void setSelectedRole(int selectedRole) {		this.selectedRole = selectedRole;	}}

⌨️ 快捷键说明

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