rolejsp.java
来自「社区文章采用的是平板、树形自由选择的两种展示方式」· Java 代码 · 共 85 行
JAVA
85 行
/*
* Created on 2007-2-22
* Last modified on 2007-3-6
* Powered by YeQiangWei.com
*/
package com.yeqiangwei.club.view.jsp;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.yeqiangwei.club.param.RoleParameter;
import com.yeqiangwei.club.service.ServiceLocator;
import com.yeqiangwei.club.service.ServiceWrapper;
import com.yeqiangwei.club.model.Role;
import com.yeqiangwei.club.service.security.RoleService;
import com.yeqiangwei.club.util.BeanLocator;
import com.yeqiangwei.club.util.BeanUtils;
import com.yeqiangwei.util.Validator;
import com.yeqiangwei.club.controller.form.RoleForm;
import com.yeqiangwei.club.view.model.RoleView;
import com.yeqiangwei.util.ParamUtils;
public class RoleJsp extends BaseJsp{
private RoleService roleService;
public RoleJsp(HttpServletRequest request, HttpServletResponse response) {
super(request, response);
}
public RoleForm getRoleForm(){
int roleId = ParamUtils.getIntParameter(request,"roleId");
RoleForm f = (RoleForm) ParamUtils.getAttribute(request,"RoleForm");
if(Validator.isEmpty(f)){
f = new RoleForm();
Role model = this.getRoleService().findById(roleId);
if(!Validator.isEmpty(model)){
BeanUtils.copyProperties(f,model);
}
}
return f;
}
public RoleService getRoleService() {
if(Validator.isEmpty(roleService)){
roleService = (RoleService) ServiceWrapper.getSingletonInstance(ServiceLocator.ROLE);
}
return roleService;
}
@SuppressWarnings("unchecked")
public List<RoleView> findAll(){
RoleParameter param = new RoleParameter();
List list = this.getRoleService().findByParameter(param);
BeanUtils.copyListProperties(list,BeanLocator.ROLEVIEW);
return list;
}
@SuppressWarnings("unchecked")
public List<RoleView> findByForumId(int forumId){
RoleParameter param = new RoleParameter();
param.setForumId(forumId);
List list = this.getRoleService().findByParameter(param);
BeanUtils.copyListProperties(list,BeanLocator.ROLEVIEW);
return list;
}
public String getBrowsePower(String str, int locator) {
return this.getRoleService().getBrowsePower(str,locator);
}
public String getOperatePower(String str, int locator) {
return this.getRoleService().getOperatePower(str,locator);
}
public String getAdminPower(String str, int locator) {
return this.getRoleService().getAdminPower(str,locator);
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?