码迷,mamicode.com
首页 > 其他好文 > 详细

下拉框

时间:2015-12-17 12:13:25      阅读:168      评论:0      收藏:0      [点我收藏+]

标签:

1.jsp:
<select class=" z9" name="sstage" id="sstage">
<c:forEach items="${sstagelist}" var="a">
<option value="${a.ck}"
<c:if test="${infoproject.sstage==a.ck}"> selected="selected"</c:if>>${a.cv}</option>
</c:forEach>
</select>

 


2.WebController:
Map<String, Object> pmap = new HashMap<String, Object>();

pmap.clear();
pmap.put("cfield", "SSTAGE");
model.addAttribute("sstagelist", commonsService.getCKVList(pmap));

 

3.CommonsService
package com.yuyoukj.service;

import java.util.List;
import java.util.Map;

import com.yuyoukj.model.nch.CKV;

public interface CommonsService {

public List<CKV> getCKVList(Map<String, Object> pmap);
}


4.CommonsServiceImpl
package com.yuyoukj.service.impl;

import java.util.List;
import java.util.Map;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.yuyoukj.mapper.nch.CKVMapper;
import com.yuyoukj.model.nch.CKV;
import com.yuyoukj.service.CommonsService;

@Service
public class CommonsServiceImpl implements CommonsService {

private static Logger log = Logger.getLogger(CommonsServiceImpl.class);

@Autowired
private CKVMapper ckvMapper;

@Override
public List<CKV> getCKVList(Map<String, Object> pmap) {
return ckvMapper.getCKVList(pmap);
}
}


5.CKVMapper
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yuyoukj.mapper.nch.CKVMapper">

<resultMap id="CKVResult" type="com.yuyoukj.model.nch.CKV">
<result property="ck" column="ck" />
<result property="cv" column="cv" />
</resultMap>

<select id="getCKVList" parameterType="java.util.HashMap" resultMap="CKVResult">
SELECT ckey as ck, cvalue as cv
FROM conf_cconfig
WHERE 1 = 1
<if test="cfield != null">
AND cfield = #{cfield}
</if>
</select>
</mapper>

下拉框

标签:

原文地址:http://www.cnblogs.com/wzz1020/p/5053318.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!