<select id="experience"> <option value ="">--请选择--</option> <#if experience??> <#list experience?keys as key> <option value="${key}">${experience[key]}</option> </#list> </#if> </select>
上面是Freemarker 的代码
下面是java的map,,如果Map 的key是Integer 类型 ,Freemarker 的${experience[key]}是取不出值来的
public Map<String,String> getExperienceMap(){ Map<String,String> map = Maps.newHashMap(); map.put("1","实习生"); map.put("2","1年"); map.put("3","1-3年"); map.put("4","3-5年"); map.put("5","5-7年"); map.put("6","7-10年"); map.put("7","10年以上"); map.put("8","不限"); return map; }
这样Map 取不到值
public Map<Integer,String> getDegreeMap(){ Map<Integer,String> map = Maps.newHashMap(); map.put(1,"初中"); map.put(2,"中专"); map.put(3,"高中"); map.put(4,"专科"); map.put(5,"职高"); map.put(6,"本科"); map.put(7,"研究生"); map.put(8,"博士"); map.put(9,"不限"); return map; }
时间: 2025-01-11 22:57:43