您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

velocity第三个应用例子--遍历集合/数组

2024/5/1 5:33:16发布11次查看
velocity第三个应用例子--遍历集合/数组
//2.create a context object velocitycontext context = newvelocitycontext(); //3.add your data objects to this context context.put("list",arrays.aslist("第一个","第二个","第三个","第四个")); //4.choose a template template template =velocity.gettemplate("list.vm"); //5.merge the template and your data toproduce the output stringwriter sw = new stringwriter(); template.merge(context, sw); sw.flush(); system.out.println(sw.tostring());
模板
#foreach($elementin $list) $element #end ====================== #foreach($ein $list) $e #end
以上就是velocity第三个应用例子--遍历集合/数组的内容。
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product