beetl的Function使用,spring配置
来源:互联网 发布:淘宝aj厂货店铺 编辑:程序博客网 时间:2024/05/23 09:31
1.有个Java类实现Function接口.
public class Print implements Function {public String call(Object[] paras, Context ctx) {Object o = paras[0];if (o != null) {try {System.out.println("nihao");ctx.byteWriter.write((o.toString()+"function").getBytes());} catch (IOException e) {throw new RuntimeException(e);}}return "";}}
paras参数是我们传的,ctx参数是框架传的。
2.
ctx.byteWriter.write((o.toString()+"function").getBytes());
这一段相当于把数据传回页面了。
3. spring配置
<beanname="printFunction"class="beetl.function.Print"/>
<beanname="beetlConfig"class="org.beetl.ext.spring.BeetlGroupUtilConfiguration"
init-method="init">
<propertyname="configFileResource"value="classpath:/beetl.properties"/>
<propertyname="functions">
<map>
<entrykey="printTest"value-ref="printFunction"/>
</map>
</property>
</bean>
4. 页面上的使用
<% printTest('abc', 'def'); %>
根据上面类的逻辑,这一段将显示abcfunction 0 0
- beetl的Function使用,spring配置
- 用beetl做spring boot的视图
- beetl使用
- Beetl实现java template的配置操作
- Beetl 自定义标签的使用笔记
- Beetl 自定义标签的使用笔记
- beetl使用过程中遇到的问题
- beetl 使用文档出炉
- jfinal 配置beetl模板引擎
- Spring MVC整合beetl之后添加国际化
- spring事务的配置使用
- Spring IOC的配置使用
- Spring Security的配置使用
- Spring IOC的配置使用
- Spring DI的配置使用
- Spring DI的配置使用
- Spring 的使用与配置
- Spring IOC的配置使用
- 剪切板
- Valid Anagram
- HBase配置HMaster死亡
- 黑马程序员——java高新技术——GUI图形化用户界面
- Java一处编译到处运行的简单原理
- beetl的Function使用,spring配置
- python 标准库-argparse 学习
- 在基于对话框的应用程序中嵌入CSplitterWnd
- javaEE
- 奇葩问题之非法字符---<200b>
- 修复数据库表方法
- C#获取多维数组的行数与列数
- 数据库连接模板
- C++ primer plus 练习10