freemarker使用bean类的一个实例
2008-01-30 09:33
381 查看
<html>[BR]
<head>[BR]
<title>Welcome!</title>[BR]
</head>[BR]
<body>[BR]
<#-- Greet the user with his/her name -->[BR]
<h1>Welcome $...{name}!</h1>[BR]
<p>We have these animals:[BR]
<ul>[BR]
<#list users as being>[BR]
<li>$...{being.name} for $...{being.price} Euros[BR]
</#list>[BR]
</ul>[BR]
</body>[BR]
</html>
public class User ...{
private String name;
private String price;
public User(String name, String price) ...{
this.name = name;
this.price = price;
}
public String getName() ...{
return name;
}
public void setName(String name) ...{
this.name = name;
}
public String getPrice() ...{
return price;
}
public void setPrice(String price) ...{
this.price = price;
}
}
Map<String, Object> root = new HashMap<String, Object>();
List<User> list = new ArrayList<User>();
list.add(new User("cat", "3.2"));
list.add(new User("test1", "1.1"));
root.put("users", list);
Map<String, Object> map = new HashMap<String, Object>();
root.put("name", "aa");
相关文章推荐
- scikit-learn一般实例之四:管道的使用:链接一个主成分分析和Logistic回归
- 一个使用Servlet文件实现文件下载的实例
- 每天一个JavaScript实例-cookie的使用方法
- 在看官方的例子时候由一个grid实例,在每一行之前有个加号,展开可以显示内容,在实际应用中还是非常有用的,照搬例子的代码,发现老是提示对象不存在,查阅资料后发现是没有加载插件,这里和大家分享下Ext.grid.RowExpander插件的使用,
- 使用mayfish,架设一个空间多个站点的实例
- 使用进程互斥实现WinForm程序只运行一个实例(VB.Net)
- 使用JBOSS, Eclipse创建一个EJB3实例程序的过程
- 一个使用第三方静态库(*.a)的jni实例以及 ndk 使用第三方静态库生成动态库的实例
- 一个使用Servlet文件实现文件下载的实例
- 使用Object.definePropery方法定义一个只读对象实例
- 高级I/O复用技术:Epoll的使用及一个完整的C实例
- WaitForMultipleObjects和Event配合使用,限制程序运行一个实例
- 使用互斥体Mutex 实现应用程序只有一个实例运行
- 安卓开源框架universal-image-loader 的使用及一个实例(转载)
- Access使用宏控制程序--1.5.一个宏的实例――检验口令
- 这是一个神奇的登录框(Bugku-web题 使用sqlmap注入实例)
- Cocos2D中Node的userObject实例变量使用时一个要注意的地方
- 一个使用游标的存储过程的实例
- 使用layui定义一个模块并使用的实例
- 【转】解压缩版tomcat配置及使用(环境变量设置及测试,一个简单的web应用实例)