rulejsp.java
来自「社区文章采用的是平板、树形自由选择的两种展示方式」· Java 代码 · 共 105 行
JAVA
105 行
/*
* Created on 2007-2-28
* Last modified on 2007-12-20
* 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.RuleParameter;
import com.yeqiangwei.club.service.ServiceLocator;
import com.yeqiangwei.club.service.ServiceWrapper;
import com.yeqiangwei.club.model.Rule;
import com.yeqiangwei.club.service.user.RuleService;
import com.yeqiangwei.club.util.BeanLocator;
import com.yeqiangwei.club.util.BeanUtils;
import com.yeqiangwei.util.Validator;
import com.yeqiangwei.club.controller.form.RuleForm;
import com.yeqiangwei.club.view.model.ForumView;
import com.yeqiangwei.club.view.model.RuleView;
import com.yeqiangwei.util.ParamUtils;
public class RuleJsp extends BaseJsp{
private int ruleId = 0;
private ForumView forumView;
public RuleJsp(HttpServletRequest request, HttpServletResponse response) {
super(request, response);
ruleId = ParamUtils.getIntParameter(request,"ruleId",0);
}
public RuleForm getRuleForm(){
RuleForm f = (RuleForm) ParamUtils.getAttribute(request,"RuleForm");
if(Validator.isEmpty(f)){
f = new RuleForm();
Rule model = this.getRuleService().findById(ruleId);
if(!Validator.isEmpty(model)){
BeanUtils.copyProperties(f,model);
}
}
return f;
}
@SuppressWarnings("unchecked")
public List<RuleView> findAll(){
RuleParameter param = new RuleParameter();
List list = this.getRuleService().findByParameter(param);
BeanUtils.copyListProperties(list,BeanLocator.RULEVIEW);
return list;
}
public Rule getForumRule() {
return this.getRuleService().findForumRule(ParamUtils.getIntParameter(request, "forumId", 0));
}
public double getScore(int locator){
return this.getRuleService().getScore(this.getForumRule().getScores(),locator);
}
public int getViews(int locator){
return this.getRuleService().getViews(this.getForumRule().getViews(),locator);
}
public double getCredit(int locator){
return this.getRuleService().getCredit(this.getForumRule().getCredits(),locator);
}
public double getMoney(int locator){
return this.getRuleService().getMoney(this.getForumRule().getMoneys(),locator);
}
public String getCredit(String str, int locator) {
return String.valueOf(this.getRuleService().getCredit(str,locator));
}
public String getMoney(String str, int locator) {
return String.valueOf(this.getRuleService().getMoney(str,locator));
}
public String getScore(String str, int locator) {
return String.valueOf(this.getRuleService().getScore(str,locator));
}
public String getViews(String str, int locator) {
return String.valueOf(this.getRuleService().getViews(str,locator));
}
public RuleService getRuleService() {
return ServiceWrapper.<RuleService>getSingletonInstance(ServiceLocator.RULE);
}
public ForumView getForumView() {
return forumView;
}
public void setForumView(ForumView forumView) {
this.forumView = forumView;
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?