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 ...
随机推荐
- HTML基础知识概括
1.html的概念 HTML是用来描述网页的一种语言. HTML指的是超文本标记语言(HyperText Markup Language) HTML不是一种编程语言,而是一种标记语言(markup l ...
- ABP官方文档翻译 5.4 SwaggerUI集成
SwaggerUI集成 介绍 ASP.NET Core 安装Nuget包 配置 测试 ASP.NET 5.x 安装Nuget包 配置 测试 介绍 在它的网站上:“...使用Swagger可用的API, ...
- IDEA Tomcat:Failed to initialize end point associated with ProtocolHandler
发现Tomcat的日志中出现这样的错误,一般都是端口被占用了.在任务管理器中检查是否有其他的应用在使用该端口 Failed to initialize end point associated wit ...
- xBIM 日志操作
目录 xBIM 应用与学习 (一) xBIM 应用与学习 (二) xBIM 基本的模型操作 xBIM 日志操作 XBIM 3D 墙壁案例 xBIM 格式之间转换 xBIM 使用Linq 来优化查询 x ...
- RHEL7.2安装
先在系统启动的时候按下Del键(有些系统是F2键)进入BIOS,设置从光盘启动. 系统只有2个USB口时,1个要接光驱,另外1个口不能同时接键盘和鼠标,可以接1个USB集线器,键盘和鼠标同时接入到集线 ...
- MySQL分区表基础
首先要确定MySQL是否支持分区: Mysql> SHOW VARIABLES LIKE '%partition%'; +-----------------------+-------+| Va ...
- BZOJ 3684: 大朋友和多叉树 [拉格朗日反演 多项式k次幂 生成函数]
3684: 大朋友和多叉树 题意: 求有n个叶子结点,非叶节点的孩子数量\(\in S, a \notin S\)的有根树个数,无标号,孩子有序. 鏼鏼鏼! 树的OGF:\(T(x) = \sum_{ ...
- IOS使用pods初次加载出现Pods-resources.sh: Permission denied错误的解决方案
在使用了pods之后首次编译加载时会出现错误 你的Pods存放目录/Pods/Target Support Files/Pods/Pods-resources.sh: Permission denie ...
- linux打印彩色字
echo显示带颜色,需要使用参数-e格式如下:echo -e "\033[字背景颜色;文字颜色m字符串\033[0m"例如: echo -e "\033[41;37m T ...
- console那些你不曾知道的玩法
一.console最常见的四种方法: FireFox(58) Chrome(51) 二.打印对象: 平时想输出对象属性时,可以直接打印对象,对Object使用toString方法会得到 [Object ...