freemarker写select组件(四)
freemarker写select组件
1、宏定义
<#macro select id datas value="" key="" text="" headKey="" headValue="">
<select id="${id}" name="${id}">
<option>---请选择---</option>
<#if headKey!="">
<option value="${headKey}">${headValue}</option>
</#if>
<#list datas as data>
<#if key!="">
<#if value == data[key]?string>
<option value="${data[key]}" selected>${data[text]}</option>
<#else>
<option value="${data[key]}">${data[text]}</option>
</#if>
<#else>
<#if value == data>
<option value="${data}" selected>${data}</option>
<#else>
<option value="${data}">${data}</option>
</#if>
</#if>
</#list>
</select>
</#macro>
2、引入宏
<@items.select id="username" datas=users key="userNo" text="userName" headKey="0" headValue="其他"/>
3、示例结果
<select id="username" name="username">
<option>---请选择---</option>
<option value="0">其他</option>
<option value="1">张三丰</option>
<option value="2">李思思</option>
<option value="3">赵武</option>
<option value="4">刘雪</option>
<option value="5">朱顾</option>
<option value="6">赵武</option>
<option value="7">吴语</option>
<option value="8">血玉</option>
</select>
freemarker写select组件(四)的更多相关文章
- freemarker写select组件(一)
freemarker写select组件 1.宏定义 <#macro select id datas> <select id="${id}" name=" ...
- freemarker写select组件(五)
freemarker写select组件 1.宏定义 <#macro select id datas value="" key="" text=" ...
- freemarker写select组件(三)
freemarker写select组件 1.宏定义 <#macro select id datas value="" key="" text=" ...
- freemarker写select组件(二)
freemarker写select组件 1.宏定义 <#macro select id datas value=""> <select id="${id ...
- freemarker写select组件报错总结(一)
1.具体错误如下 六月 25, 2014 11:26:29 下午 freemarker.log.JDK14LoggerFactory$JDK14Logger error 严重: Template pr ...
- freemarker写select组件报错总结(四)
1.错误描述 <html> <head> <meta http-equiv="content-type" content="text/htm ...
- freemarker写select组件(二十二)
一,讲解一 1.宏定义 <#macro select id datas> <select id="${id}" name="${id}"> ...
- freemarker写select组件报错总结(二)
1.错误描述 六月 25, 2014 11:32:49 下午 freemarker.log.JDK14LoggerFactory$JDK14Logger error 严重: Template proc ...
- freemarker写select组件报错总结(七)
1.错误描述 六月 26, 2014 11:26:27 下午 freemarker.log.JDK14LoggerFactory$JDK14Logger error 严重: Template proc ...
随机推荐
- How to create and start VirtualBox VM without GUI
Suppose you want to create and run virtual machines (VMs) on VirtualBox. However, a host machine doe ...
- 解决AspNet Zero Core 5.0.1无法运行的问题
最近在研究AspNet Zero Core 5.0.1时发现VS点击调试后就自动退出了,从ABP QQ群里得知作者加入了licensecode校验.经过一个周左右断断续续的折腾,算是破解了吧.原本想把 ...
- ABP官方文档翻译 6.5 内嵌资源文件
内嵌资源文件 介绍 创建内嵌文件 xproj/project.json形式 csproj形式 添加内嵌资源管理器 使用内嵌视图 使用内嵌资源 ASP.NET Core 配置 忽略文件 重写内嵌文件 介 ...
- win7 重装 docker 启动后无法启动错误解决
描述 win7 重新安装Docker 后启动 Docker Quickstart Terminal 出现如下错误 Starting "default"... (default) ...
- java web 获取客户端操作系统信息
package com.java.basic.pattern; import java.util.regex.Matcher; import java.util.regex.Pattern; /** ...
- Eclipse远程调试应用程序
第一步,在应用程序的配置文件run.xml中加入下面的配置项,启动应用程序: <target name="run" depends="checkBuilderFai ...
- BZOJ 4176: Lucas的数论 [杜教筛]
4176: Lucas的数论 题意:求\(\sum_{i=1}^n \sum_{j=1}^n \sigma_0(ij)\) \(n \le 10^9\) 代入\(\sigma_0(nm)=\sum_{ ...
- BZOJ 2733: [HNOI2012]永无乡 [splay启发式合并]
2733: [HNOI2012]永无乡 题意:加边,询问一个连通块中k小值 终于写了一下splay启发式合并 本题直接splay上一个节点对应图上一个点就可以了 并查集维护连通性 合并的时候,把siz ...
- Oracle的order by的中文排序问题
Oracle 中查询结果按照某个中文字段或者英文字母(包括 符号)排序,并不会得到我们预期的结果,因为对于中文与英文字母及符号,Oracle实际是按照其对应的ASCII码值排序的! 可以看到按照中文村 ...
- opencv-python与c++ opencv中的一些区别和基础的知识
使用opencv-python一段时间了,因为之前没有大量接触过c++下的opencv,在网上看c++的一些程序想改成python遇到了不少坑,正好在这里总结一下. 1.opencv 中x,y,hei ...