附:在开始用.XML配置文件的方式前,先附出另外一种直接在JSP页面中设置的下拉列表吧
/****附********************************************************************************/
<s:set name="searchColumnList" value="#{'YCSS_FLOWNO':'YCSS凭证号','YCSS_ORIGCARDID':'YCSS源单号','CUSTNAME':'客户名称','CUSTID':'客户ID','OWNERPHONE1':'客户电话','DRIVERNAME':'车主姓名'}" />
<s:select list="#searchColumnList" name="condition.searchColumn"/>
/****附********************************************************************************/
好以下就开始用XML文件形式弄了
一:在JSP中的调用如下:
<s:select list="#application.callBackTypeList" name="condition.callBackType" headerKey="" headerValue="全部"/>
二:/*****Spring文件spring-util.xml****************************************************/
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:jee="http://www.springframework.org/schema/jee" xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:aop="http://www.springframework.org/schema/aop" xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd
http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-2.5.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.5.xsd">
<bean id="applicationContextAction" class="com.skylink.csms.common.action.ApplicationContextAction"
init-method="process">
<property name="commonMap">
<map>
<entry key="okList" value-ref="okList" />
<entry key="satisfyList" value-ref="satisfyList" />
<entry key="accordList" value-ref="accordList" />
<entry key="logosList" value-ref="logosList" />
<!-- 调查结果字典表 -->
<entry key="searchResultList" value-ref="searchResultList" />
<!-- 呼叫结果字典表 -->
<entry key="callResultList" value-ref="callResultList" />
<!-- 回访任务状态字典表 -->
<entry key="taskStatusList" value-ref="taskStatusList" />
<entry key="inTimeList" value-ref="inTimeList" />
<entry key="servItemList" value-ref="servItemList" />
<!-- 回访单类型 -->
<entry key="callBackTypeList" value-ref="callBackTypeList" />
<!-- 抱怨项目 改进项目 好评项目 -->
<entry key="servReasonList" value-ref="servReasonList" />
<!-- 费用抱怨 -->
<entry key="servReasonDetailList" value-ref="servReasonDetailList" />
<!-- 实际赠送 -->
<entry key="realPreentMatList" value-ref="realPreentMatList" />
<!-- 高润 价格 -->
<entry key="lubePriceList" value-ref="lubePriceList" />
<!-- 高润 渠道 -->
<entry key="lubeChannelList" value-ref="lubeChannelList" />
</map>
</property>
<property name="databaseCommonMap">
<map>
<!-- 办事处 -->
<entry key="officeList"
value="SELECT OFFICE_CODE ,OFFICE_NAME FROM SLYC_OFFICE_T WHERE DEL_FLAG='0' ORDER BY OFFICE_CODE">
</entry>
<!-- 配件子公司 -->
<entry key="fittingsCorpList"
value="SELECT ID ,NAME FROM SLYC_FITTINGS_CORP WHERE VALID='0' ORDER BY ID">
</entry>
<!-- 车辆 -->
<entry key="cartypeList"
value="SELECT cartype_code, cartype_name FROM slyc_cartype_t ORDER BY cartype_code">
</entry>
</map>
</property>
</bean>
<!-- 用户回访 下拉列表 -->
<util:map id="okList">
<entry key="0" value="无" />
<entry key="1" value="是" />
<entry key="2" value="否" />
</util:map>
<util:map id="satisfyList">
<entry key="0" value="无" />
<entry key="1" value="很满意" />
<entry key="2" value="满意" />
<entry key="3" value="一般" />
<entry key="4" value="不满意" />
<entry key="5" value="很不满意" />
</util:map>
<util:map id="accordList">
<entry key="0" value="无" />
<entry key="1" value="相符" />
<entry key="2" value="不相符" />
</util:map>
<util:map id="logosList">
<entry key="0" value="理性" />
<entry key="1" value="非理性" />
</util:map>
<!-- 调查结果字典表 -->
<util:map id="searchResultList">
<entry key="0" value="无" />
<entry key="1" value="成功结束" />
<entry key="3" value="未联系到客户" />
<entry key="4" value="稍候再呼叫" />
<entry key="5" value="注销本任务" />
</util:map>
<!-- 呼叫结果字典表 -->
<util:map id="callResultList">
<entry key="0" value="无" />
<entry key="1" value="接通" />
<entry key="2" value="关机" />
<entry key="3" value="无人接听" />
<entry key="4" value="拒接" />
<entry key="5" value="不在服务区" />
<entry key="6" value="掉线" />
<entry key="7" value="号码错" />
<entry key="8" value="空号" />
<entry key="9" value="停机" />
<entry key="10" value="用户拒访" />
<entry key="11" value="遇忙" />
<entry key="12" value="稍候再拨" />
<entry key="13" value="其它" />
</util:map>
<!-- 回访任务状态字典表 -->
<util:map id="taskStatusList">
<entry key="0" value="未访" />
<entry key="1" value="未应答" />
<entry key="2" value="暂存" />
<entry key="3" value="复电" />
<entry key="4" value="成功" />
<entry key="5" value="注销" />
<entry key="6" value="稍后呼叫" />
</util:map>
<util:map id="inTimeList">
<entry key="0" value="无" />
<entry key="1" value="及时" />
<entry key="2" value="不及时" />
</util:map>
<util:map id="servItemList">
<entry key="0" value="无" />
<entry key="1" value="走保" />
<entry key="2" value="维修" />
<entry key="3" value="强保" />
</util:map>
<!-- 回访单类型 -->
<util:map id="callBackTypeList">
<entry key="1" value="维修" />
<entry key="4" value="走保" />
<entry key="12" value="整改" />
<entry key="18" value="特殊活动" />
<entry key="S" value="服务站抽查" />
</util:map>
<!-- 抱怨项目 改进项目 好评项目 -->
<util:map id="servReasonList">
<entry key="1" value="配件供应" />
<entry key="2" value="服务态度" />
<entry key="3" value="服务及时" />
<entry key="4" value="维修技能" />
<entry key="5" value="收费标准" />
<entry key="6" value="调件" />
<entry key="7" value="机油" />
</util:map>
<!-- 费用抱怨 -->
<util:map id="servReasonDetailList">
<entry key="1" value="机油" />
<entry key="2" value="机滤" />
<entry key="3" value="柴滤" />
<entry key="4" value="配件" />
<entry key="5" value="材料" />
<entry key="6" value="其它" />
</util:map>
<!-- 实际赠送 -->
<util:map id="realPreentMatList">
<entry key="1" value="机油" />
<entry key="2" value="空滤芯" />
<entry key="3" value="机滤" />
<entry key="4" value="柴滤" />
<entry key="5" value="配件卡" />
</util:map>
<!-- 高润 价格 -->
<util:map id="lubePriceList">
<entry key="0" value="无" />
<entry key="1" value="合理" />
<entry key="2" value="高" />
<entry key="3" value="低" />
<entry key="4" value="不清楚" />
</util:map>
<!-- 高润 渠道 -->
<util:map id="lubeChannelList">
<entry key="0" value="无" />
<entry key="1" value="选购方便" />
<entry key="2" value="选购困难" />
<entry key="3" value="不清楚" />
</util:map>
</beans>
三:/*****JAVA文件ApplicationContextAction.java************************************************/
package com.skylink.csms.common.action;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.Map.Entry;
import javax.annotation.Resource;
import javax.servlet.ServletContext;
import org.springframework.web.context.ServletContextAware;
import com.skylink.common.hibernate.dao.GenericDAOI;
public class ApplicationContextAction implements ServletContextAware {
/**
*
*/
private static final long serialVersionUID = -6206105058685576675L;
private ServletContext context;
private final Map<String, Map<String, String>> items = new HashMap();
private GenericDAOI dao;
@Resource(name="genericDAO")
public void setDao(GenericDAOI dao) {
this.dao = dao;
}
@Override
public void setServletContext(ServletContext context) {
this.context = context;
}
public String process() {
Set<Entry<String, Map<String, String>>> set = items.entrySet();
for (Entry<String, Map<String, String>> item : set) {
context.setAttribute(item.getKey(), item.getValue());
}
return "success";
}
public void setCommonMap(Map<String, Map<String, String>> items) {
Set<Entry<String, Map<String, String>>> set = items.entrySet();
for (Entry<String, Map<String, String>> item : set) {
this.items.put(item.getKey(), item.getValue());
}
//this.items.put("callBackTypeList", value)
}
public void setDatabaseCommonMap(Map<String, String> items) {
Set<Entry<String, String>> set = items.entrySet();
for (Entry<String, String> item : set) {
List<Object[]> list = dao.findBySql(item.getValue(), -1, -1);
Map<String, String> dbItem = new LinkedHashMap<String, String>();
for (Object[] obj : list) {
dbItem.put(obj[0].toString(), obj[1].toString());
}
this.items.put(item.getKey(), dbItem);
}
}
public void clear() {
Set<String> keys = items.keySet();
for (String key : keys) {
context.removeAttribute(key);
}
items.clear();
}
}