下拉值的渲染


1.jsp

<%@ page contentType="text/html; charset=UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme() + "://"+ request.getServerName() + ":" + request.getServerPort()    + path + "/";
%>   


    
    
    
    
    
    
    
 

        
class="pTit" id="toptitle">
class="fLef">
class="fMid">板块 > 新增
class="bBac">
class="fMid" id="pagemenubar">
class="eTab">
模块名称
所属模块
积分动作
所得积分值 请填写class="red">整数
最大积分上限(日) 请填写class="red">整数,class="red">0表示class="red">无上限
最大积分上限(月) 请填写class="red">整数,class="red">0表示class="red">无上限
顺序 填写class="red">数字,数字class="red">越大显示顺序class="red">越靠后
说明

2.controller

package com.velcro.kms.score.action;

import java.util.List;

import javax.servlet.http.HttpServletRequest;

import com.velcro.kernel.base.setitem.service.ISetitemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import com.navi.utils.IPage;
import com.navi.utils.NumberUtils;
import com.navi.utils.SingletonUtils;
import com.navi.web.WebUtils;
import com.velcro.base.BaseContext;
import com.velcro.base.selectitem.service.SelectitemService;
import com.velcro.kernel.base.label.service.ILabelService;
import com.velcro.kernel.base.selectitem.model.ISelectitem;
import com.velcro.kms.common.model.ListBean;
import com.velcro.kms.score.model.ScoreSetting;
import com.velcro.kms.score.service.ScoreSettingService;

/**
 * 积分配置控制类
 */
@Controller
public class ScoreSettingAction {

    private ScoreSettingService scoreService=SingletonUtils.getSingleton("com.velcro.kms.score.service.impl.ScoreSettingServiceImpl");
    private SelectitemService selectitemService = BaseContext.getBean("selectitemService");
    @Autowired
    private ISetitemService setitemservice;
    
    @RequestMapping("/kms/scoresetting/addUI")
    public ModelAndView addUI(HttpServletRequest req){
        ModelAndView mav=new ModelAndView("kms/score/scoreSetting/scoreSetting-addUI");
        List moduleList=scoreService.getModules();
        List scoreSettingTypeList=scoreService.getScoreSettingType();
        IPage page=scoreService.view(new ScoreSetting(), 1, 500);
        int count=page.getRecordCount()+1;
        mav.addObject("moduleList", moduleList);
        mav.addObject("scoreSettingTypeList", scoreSettingTypeList);
        mav.addObject("count", count);
        return mav;
    }
    
    
    @RequestMapping("/kms/scoresetting/list")
    public ModelAndView list(HttpServletRequest req){
        ModelAndView mav=new ModelAndView("kms/score/scoreSetting/scoreSetting-list");
        int currentPage=NumberUtils.objToInt(req.getParameter("currentPage"), 1);
        int pageSize=NumberUtils.objToInt(req.getParameter("pageSize"), 20);
        ScoreSetting scoreSetting=WebUtils.requestToBean(req, ScoreSetting.class);
        IPage page=scoreService.view(scoreSetting, currentPage, pageSize);
        List list=page.getRecordList();
        @SuppressWarnings("unchecked")
        List items = (List) selectitemService.getSelectitemList("8a1fd8655e36343e015e3637653d0008", null);
        ILabelService labelService = (ILabelService) BaseContext.getBean("labelService");
        for (ISelectitem item : items) {
            item.setObjname(labelService.getLabel(item.getObjname()).getLabelname());
        }
        //积分动作
        List itemsType = (List) selectitemService.getSelectitemList("8ae119b64206e636014206eec642000d", null);
        for (ISelectitem item : itemsType) {
            item.setObjname(labelService.getLabel(item.getObjname()).getLabelname());
        }
        String openValue=setitemservice.getSetitemvalueById("8a070cd8707c5b7f0170805b39620024");
        mav.addObject("item", items);
        mav.addObject("openValue", openValue);
        mav.addObject("itemsType", itemsType);
        mav.addObject("pageBean", page);
        mav.addObject("list", list);
        mav.addObject("scoreSetting", scoreSetting);
        return mav;
    }
    
    @RequestMapping("/kms/scoresetting/add")
    public ModelAndView add(HttpServletRequest req){
        ModelAndView mav=new ModelAndView("redirect:/kms/scoresetting/list.do");
        ScoreSetting scoreSetting=WebUtils.requestToBean(req, ScoreSetting.class);
        scoreSetting.setIsDelete(0);//默认添加的都为1
        scoreService.save(scoreSetting);
        return mav;
    }
    
    @RequestMapping("/kms/scoresetting/delete")
    public ModelAndView delete(HttpServletRequest req){
        ModelAndView mav=new ModelAndView("redirect:/kms/scoresetting/list.do");
        String id=req.getParameter("id");
        boolean i=scoreService.delete(id);
        return mav;
    }
    
    @RequestMapping("/kms/scoresetting/edit")
    public ModelAndView edit(HttpServletRequest req){
        String path="";
        ScoreSetting scoreSetting=WebUtils.requestToBean(req, ScoreSetting.class);
        String id=req.getParameter("id");
        String action=req.getParameter("action");
        if("editUI".equals(action)){
            scoreSetting=scoreService.getById(id);
            path="kms/score/scoreSetting/scoresetting-editUI";
        }
        if("edit".equals(action)){
            scoreService.update(scoreSetting);
            path="redirect:/kms/scoresetting/list.do";
        }
        ModelAndView mav=new ModelAndView(path);
        //模块
        List items = (List) selectitemService.getSelectitemList("8a1fd8655e36343e015e3637653d0008", null);
        ILabelService labelService = (ILabelService) BaseContext.getBean("labelService");
        for (ISelectitem item : items) {
            item.setObjname(labelService.getLabel(item.getObjname()).getLabelname());
        }
        //积分动作
        List itemsType = (List) selectitemService.getSelectitemList("8ae119b64206e636014206eec642000d", null);
        for (ISelectitem item : itemsType) {
            item.setObjname(labelService.getLabel(item.getObjname()).getLabelname());
        }
        mav.addObject("item", items);
        mav.addObject("itemsType", itemsType);
        mav.addObject("scoreSetting", scoreSetting);
        return mav;
    }
    
    @RequestMapping("/kms/score/scoreHelp")
    public ModelAndView scoreHelp(HttpServletRequest req){
        ModelAndView mav=new ModelAndView("kms/score/score-help");
        /*int currentPage=NumberUtils.objToInt(req.getParameter("currentPage"), 1);
        int pageSize=NumberUtils.objToInt(req.getParameter("pageSize"), 20);*/
        ScoreSetting scoreSetting=WebUtils.requestToBean(req, ScoreSetting.class);
        IPage page=scoreService.view(scoreSetting, 1, 999999999);
        List list=page.getRecordList();
        mav.addObject("pageBean", page);
        mav.addObject("list", list);
        return mav;
    }
}