freemaker遍历list,我知道可以用<#list></#list>,但是如果这些数据里面有需要用到下拉框的属性,该如何写代码呢?比如list里面存了十个人的数据,每个人都有一个省份的信息,需要用到下拉框,这时候代码可以怎么写,求大神指导!!
问题问的不是很清楚啊。
可以再详细一点吗?
<#list cmAllInfoDto.cmContactInfoList as c>
<input type="hidden" name="cmAllInfoDto.cmContactInfoList[${c_index}].contactId" value="${c.contactId}">
<div class="control-group">
<label class="control-label" for="focusedInput">联系电话</label>
<div class="controls">
<input class="input-xlarge focused" style="text-align: left; width:10em;" name="cmAllInfoDto.cmContactInfoList[${c_index}].contactNo" id="focusedInput" type="text" value='${(c.contactNo)!""}'>
  类型    
<select id="selectContact${c_index}" name="cmAllInfoDto.cmContactInfoList[${c_index}].type" style="width:6em;">
<option value="MOBILE">手机</option>
<option value="EMAIL">邮箱</option>
<option value="PHONE">电话</option>
<option value="QQ">QQ</option>
<option value="WEIXIN">微信</option>
<option value="FAX">传真</option>
</select>
  是否优先    
<select id="selectPrior${c_index}" name="cmAllInfoDto.cmContactInfoList[${c_index}].prior" style="width:6em;">
<option value="Y">是</option>
<option value="N">不是</option>
</select>
  状态    
<select id="selectStaus${c_index}" name="cmAllInfoDto.cmContactInfoList[${c_index}].staus" style="width:6em;">
<option value="Y">有效</option>
<option value="N">无效</option>
</select>
</div>
</div>
</#list>
不好意思,我发现我不会这个freemarker。之前没主要到,以为只是HTML CSS的问题。没想到这个是一个模板引擎。
请选择
<#list yourList as List>
${List.option}
</#list>
我代码发不出去貌似,就是把选项写在list标签中间就可以了