Beetl bug修复和功能增强

修复和增强了如下功能:

1 文本处理函数 报错,行数定位不精确的问题

2 默认情况下,优化模式不再保留生成的java源代码

3 Web容器由于不一定能提供web的绝对地址,所以给出警告,最好为优化模式下,设置class目录绝对路径

4 提供了注册functionPage的方法,如下

group.registerFunctionPackage("string", new Object(){

			/**
			 * @param str
			 * @param from d对于数字型,beetl里都使用BeeNumber
			 * @param to
			 * @return
			 * @throws Exception
			 */
			public String sub(String str,BeeNumber from,BeeNumber to) throws Exception{
				
				if(str==null){
					throw new Exception("error paramter");
				}
				return str.substring(from.intValue(), to.intValue());
			}
		
			public void print(String str,Context ctx){
				Writer w = (Writer)ctx.getVar("__pw");
				try {
					w.write(str);
				} catch (IOException e) {
					throw new RuntimeException(e.getMessage());
				}
				
			}
			
		});

如上注册了俩个方法,分别是string.sub方法以及string.print函数

 

5,修复了一些优化模式运行下的bug。

感谢诸多朋友在实际使用中提供的建议和在实际使用中将发现的bug发给我。

 

http://beetl.sourceforge.net/

 

 

猜你喜欢

转载自javamonkey.iteye.com/blog/1535805