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 value="" key="" text=" ...
- 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.错误描述 <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.具体错误如下 六月 25, 2014 11:26:29 下午 freemarker.log.JDK14LoggerFactory$JDK14Logger error 严重: Template pr ...
随机推荐
- 【例题5-1 UVA 10474 】Where is the Marble?
[链接] 我是链接,点我呀:) [题意] 在这里输入题意 [题解] 排序 用lower_bound找就可以了. ->lower_bound,如果里面所有的数字都比x小,那么它的返回值会越界! [ ...
- itunes app 下载链接的几种表现形式
第一种:itunes://itunes.apple.com/cn/app/id794862904 ,这是最普通的一种. 直接在浏览器中输入.就能够打开电脑上安装的itunes,并跳转到相应的app下载 ...
- 【源代码】Timer和TimerTask源代码剖析
Timer是java.util包中的一个工具类,提供了定时器的功能. 我们能够构造一个Timer对象,然后调用其schedule方法在某个特定的时间或者若干延时之后去运行一个特定的任务.甚至你能够让其 ...
- 学习Numpy基础操作
# coding:utf-8 import numpy as np from numpy.linalg import * def day1(): ''' ndarray :return: ''' ls ...
- C#人脸识别
C#百度人脸识别 最近看到一只我家徒儿发来的链接,原来是一堆百度AI的SDK,于是一时兴起就做了一只人脸识别,喵喵喵(●'◡'●) 一.准备工作 首先,当然是下载SDK啦:http://ai.baid ...
- C# WebQQ协议群发机器人(一)
原创性申明 本文地址 http://blog.csdn.net/zhujunxxxxx/article/details/38931287 转载的话请注明出处. 之前我也写过一篇使用python来实现的 ...
- Tomcat的JVM经常挂掉,根据hs_err_pid23224.log这种日志文件,也没能发现具体是什么原因导致的
## A fatal error has been detected by the Java Runtime Environment:## SIGBUS (0x7) at pc=0x00007f1a ...
- [React Native] Installing and Linking Modules with Native Code in React Native
Learn to install JavaScript modules that include native code. Some React Native modules include nati ...
- Maven学习笔记(六):生命周期与插件
何为生命周期: Maven的生命周期就是为了对全部的构建过程进行抽象和统一.Maven从大量项目和构建工具中学习和反思,然后总结了一套高度完好的.易扩展的生命周期.这个生命周期包括了项目的清 ...
- Qt的paint函数重写,以及QPaint给一条线绘制箭头
直接代码: QPainter *painter; static const double Pi = 3.14159265358979323846264338327950288419717; stati ...