javamonkey / beetl2.0 Goto Github PK
View Code? Open in Web Editor NEWbeetl2.0
License: BSD 3-Clause "New" or "Revised" License
beetl2.0
License: BSD 3-Clause "New" or "Revised" License
ClasspathResourceLoader 需要添加一个getCharset方法
如题,对 类型申明的时候,如上方式不工作
rt
当调用render()返回一个不存在或者错误的资源页面的时候,控制台输出信息应该是
资源:view名,模板根目录 而不是资源:null,模板根目录
另外在controller中,如果没有调用render(),就打印了一句话,控制台也会输出模板加载错误,资源:null 这是为何?
html 需要一个转义的格式化函数
${content,html}
原有方式,需要将模板中标签变量的申明和代码里的变量一致,导致了使用不方便,建议标签实现提供按照顺寻绑定的方式,如:
binding(new Objecct[value1,value2]);
<#tag attr=""
attr2 = "" > 报错
因为需要实现序列化,tagFactory子类可能没有序列化
需要下载spring,jfinal等各种包
变量为空(NULL):name 位于4行 资源:/org/beetl/core/lab/hello.txt
空指针
1|<%
2|
3|%>
4|${user.name}
实际上是user为空
public BeetlRenderFactory(String templatesPath) 。。。。
<%
if("lijz"=="lijz"){
print('{display:"店铺名称",name:"SHOP_HEAD_ID",newline:false,type:"text",validate:{required:true}},');
}else{
print('{display:"店铺名称",name:"SHOP_HEAD_ID",newline:false,type:"select",'
+' options : { '
+' valueField: "SHOP_HEAD_ID", '
+' textField: "SHOP_NAME", '
+' url:rootPath + "business/base/shopinfo/getShop", '
+' autocomplete: true '
+' }'
+'},');
}
%>
必须用+,否则报缺少符号CLASS_METHOD 。
动态绑定类型判断出错不应该停止模板渲染
java方法调用错误应该显示异常而不是InvokationTagetException
对于crossmvc来说,这是必须的,beetlkit虽然能运行,但他与mvc框架无法集成
语法错误需判断一下是否有全角符号,如;)“‘
## #是否检测文件变化
RESOURCE.autouCheck
@javamonkey 确定这里不是autoCheck?
虽然我知道比较直接,但是秉着对一个开源软件认真负责的态度,放个issue解决问题,让大家少走弯路。
Exception in thread "pool-5-thread-3" java.lang.OutOfMemoryError: PermGen space
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2427)
at java.lang.Class.getDeclaredMethod(Class.java:1935)
at java.io.ObjectStreamClass.getPrivateMethod(ObjectStreamClass.java:1382)
at java.io.ObjectStreamClass.access$1700(ObjectStreamClass.java:52)
at java.io.ObjectStreamClass$2.run(ObjectStreamClass.java:438)
at java.security.AccessController.doPrivileged(Native Method)
at java.io.ObjectStreamClass.(ObjectStreamClass.java:413)
at java.io.ObjectStreamClass.lookup(ObjectStreamClass.java:310)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1106)
at java.io.ObjectOutputStream.writeArray(ObjectOutputStream.java:1338)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1146)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1474)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:326)
at org.beetl.core.om.ObjectUtil.copy(ObjectUtil.java:76)
at org.beetl.core.statement.ProgramMetaData.copy(ProgramMetaData.java:140)
at org.beetl.core.engine.TypeBindingProbe.(TypeBindingProbe.java:31)
at org.beetl.core.engine.FastRuntimeEngine.createProgram(FastRuntimeEngine.java:20)
at org.beetl.core.GroupTemplate.loadTemplate(GroupTemplate.java:365)
at org.beetl.core.GroupTemplate.getTemplate(GroupTemplate.java:320)
使用tomcat部署环境,使用beetl2.0.2版本,帮忙分析下
如:
date1>data2
类似c语言的include,物理文件链接。
缺点是此文件变化,需要重新编译所有文件,优点是速度快
NATIVE_CALL_INVALID
at org.beetl.core.om.ObjectUtil.invoke(ObjectUtil.java:414)
at org.beetl.core.om.ObjectUtil.invokeObject(ObjectUtil.java:441)
at org.beetl.core.fun.SingleFunctionWrapper.call(SingleFunctionWrapper.java:65)
at org.beetl.core.statement.FunctionExpression.evaluate(FunctionExpression.java:76)
at org.beetl.core.statement.PlaceholderST.execute(PlaceholderST.java:32)
global var aa = 1;
aa 这个变量你能成为全局变量,被子模板,function等引用
建议增加compress标签压缩页面空白。
JSP中有:<%@ page trimDirectiveWhitespaces="true" %>
FreeMarker中有:<#compress></#compress>标签取出空行。
展望:
isTrue?truValue 提示失败
VAR_NOT_DEFINED:varName 位于2行 资源:/org/beetl/core/lab/hello.txt
1|<%
2|var a = @user1.getName();
3|%>
user1不存在,应该报user1的错误
如果 var a = 11111111111111111; 则解析报错
创建Tag错(TAG_INSTANCE_ERROR):cache 位于3行 资源:<% //请指定你...
1|<%
2|//请指定你的缓存key
3|cache("key",60,false){
4|%>
5|date = ${date(),dateFormat='yy-MM-dd hh:mm::ss'}
6|<%}%>
org.beetl.core.statement.TagStatement.execute(TagStatement.java:68)
org.beetl.core.statement.Program.execute(Program.java:70)
org.beetl.core.Template.renderTo(Template.java:119)
org.beetl.core.Template.renderTo(Template.java:85)
org.beetl.core.Template.render(Template.java:72)
org.beetl.core.BeetlKit.render(BeetlKit.java:96)
org.beetl.core.BeetlKit.testTemplate(BeetlKit.java:194)
org.bee.tl.online.TestServlet.doPost(TestServlet.java:221)
javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
ResourceLoader 增加一个方法判断资源是否存在
dictSelect 有来个同名方法,第二个参数分别是字符或者数字
NATIVE_CALL_EXCEPTION:flyfox.dictSelect 位于46行 资源:/pages/money/add.bee
参数不匹配 flyfox.dictSelect
43|
44| 45| ${flyfox.dictSelect('moneyType',model.type)} 46|
47|
48|
163行有问题,应该判顿"/"
支持elcipse插件,能支持:
语法着色
属性提示
属性重构
debug功能
Exception in thread "main" java.lang.RuntimeException: 初始化失败
at org.beetl.core.GroupTemplate.(GroupTemplate.java:135)
at org.beetl.sample.s01.FilePathRL.main(Unknown Source)
Caused by: java.lang.RuntimeException: java.lang.IllegalAccessException: Class org.beetl.core.om.ObjectUtil can not access a member of class java.lang.Math with modifiers "private"
at org.beetl.core.om.ObjectUtil.instance(ObjectUtil.java:543)
at org.beetl.core.GroupTemplate.initFunction(GroupTemplate.java:180)
at org.beetl.core.GroupTemplate.init(GroupTemplate.java:154)
at org.beetl.core.GroupTemplate.(GroupTemplate.java:130)
... 1 more
Caused by: java.lang.IllegalAccessException: Class org.beetl.core.om.ObjectUtil can not access a member of class java.lang.Math with modifiers "private"
at sun.reflect.Reflection.ensureMemberAccess(Reflection.java:109)
at java.lang.Class.newInstance(Class.java:368)
at org.beetl.core.om.ObjectUtil.instance(ObjectUtil.java:535)
... 4 more
增加一个支持支持key为文件或者为字符串的resoureloader,这能满足一般的cms应用场景
java.lang.NullPointerException
at org.beetl.core.statement.NativeCallExpression.evaluate(NativeCallExpression.java:69)
at org.beetl.core.statement.VarAssignStatement.execute(VarAssignStatement.java:52)
at org.beetl.core.statement.VarAssignStatementSeq.execute(VarAssignStatementSeq.java:53)
at org.beetl.core.statement.Program.execute(Program.java:70)
at org.beetl.core.engine.FastRuntimeEngine$FilterProgram.execute(FastRuntimeEngine.java:43)
at org.beetl.core.Template.renderTo(Template.java:120)
at org.beetl.core.Template.renderTo(Template.java:86)
at org.beetl.ext.web.WebRender.render(WebRender.java:74)
@input 无属性情况下,出错
for(map in List){
var listmap = map["value"].~size;
}
这么写的话会报错。
java.lang.NullPointerException
at org.beetl.core.statement.VarVirtualAttribute.infer(VarVirtualAttribute.java:39)
at org.beetl.core.statement.VarRef.infer(VarRef.java:160)
at org.beetl.core.statement.VarAssignStatement.infer(VarAssignStatement.java:69)
at org.beetl.core.statement.VarAssignStatementSeq.infer(VarAss
<#test:a id="111"></#test:a>
<#test:a id="222"></#test:a>
如上,输出1112222,期望是
111
222
换行被吃掉了
<#tagbinding value="123";sl >
${sl}
</#tagbinding>
期望只输出一行(对应模板中间行),但这一行前面还有个回车换行
<#tagloopbinding value="2" ; s1 >
<%
for(item in s1){
print(item);
}
%>
</#tagloopbinding>
${model.title!"默认值"}即使title为null,安全输出无效
希望提供一个集合函数,按照索引获取元素,如果索引越界,仅仅返回null而不是抛出异常
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ beetl-performance ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 33 source files to /Users/Guo/deploy/beetl2.0/beetl-performance/target/classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /Users/Guo/deploy/beetl2.0/beetl-performance/src/main/java/org/beetl/performance/lab/IteratorMakeTest.java:[30,39] 无法将类 org.beetl.core.IteratorStatus中的方法 getIteratorStatus应用到给定类型;
需要: java.lang.Object
找到: java.util.Map,int
原因: 实际参数列表和形式参数列表长度不同
[ERROR] /Users/Guo/deploy/beetl2.0/beetl-performance/src/main/java/org/beetl/performance/lab/IteratorMakeTest.java:[34,39] 无法将类 org.beetl.core.IteratorStatus中的方法 getIteratorStatus应用到给定类型;
需要: java.lang.Object
找到: java.util.Map,int
原因: 实际参数列表和形式参数列表长度不同
[ERROR] /Users/Guo/deploy/beetl2.0/beetl-performance/src/main/java/org/beetl/performance/lab/IteratorMakeTest.java:[40,39] 无法将类 org.beetl.core.IteratorStatus中的方法 getIteratorStatus应用到给定类型;
需要: java.lang.Object
找到: java.util.Map,int
原因: 实际参数列表和形式参数列表长度不同
[ERROR] /Users/Guo/deploy/beetl2.0/beetl-performance/src/main/java/org/beetl/performance/lab/IteratorMakeTest.java:[52,39] 无法将类 org.beetl.core.IteratorStatus中的方法 getIteratorStatus应用到给定类型;
需要: java.lang.Object
找到: java.util.Map,int
原因: 实际参数列表和形式参数列表长度不同
[INFO] 4 errors
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] beetl-parent ...................................... SUCCESS [1.564s]
[INFO] beetl-core ........................................ SUCCESS [6.894s]
[INFO] beetl-performance ................................. FAILURE [0.221s]
[INFO] beetl-samples ..................................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 8.859s
[INFO] Finished at: Tue Sep 09 16:48:14 CST 2014
[INFO] Final Memory: 25M/982M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project beetl-performance: Compilation failure: Compilation failure:
[ERROR] /Users/Guo/deploy/beetl2.0/beetl-performance/src/main/java/org/beetl/performance/lab/IteratorMakeTest.java:[30,39] 无法将类 org.beetl.core.IteratorStatus中的方法 getIteratorStatus应用到给定类型;
[ERROR] 需要: java.lang.Object
[ERROR] 找到: java.util.Map,int
[ERROR] 原因: 实际参数列表和形式参数列表长度不同
[ERROR] /Users/Guo/deploy/beetl2.0/beetl-performance/src/main/java/org/beetl/performance/lab/IteratorMakeTest.java:[34,39] 无法将类 org.beetl.core.IteratorStatus中的方法 getIteratorStatus应用到给定类型;
[ERROR] 需要: java.lang.Object
[ERROR] 找到: java.util.Map,int
[ERROR] 原因: 实际参数列表和形式参数列表长度不同
[ERROR] /Users/Guo/deploy/beetl2.0/beetl-performance/src/main/java/org/beetl/performance/lab/IteratorMakeTest.java:[40,39] 无法将类 org.beetl.core.IteratorStatus中的方法 getIteratorStatus应用到给定类型;
[ERROR] 需要: java.lang.Object
[ERROR] 找到: java.util.Map,int
[ERROR] 原因: 实际参数列表和形式参数列表长度不同
[ERROR] /Users/Guo/deploy/beetl2.0/beetl-performance/src/main/java/org/beetl/performance/lab/IteratorMakeTest.java:[52,39] 无法将类 org.beetl.core.IteratorStatus中的方法 getIteratorStatus应用到给定类型;
[ERROR] 需要: java.lang.Object
[ERROR] 找到: java.util.Map,int
[ERROR] 原因: 实际参数列表和形式参数列表长度不同
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <goals> -rf :beetl-performance
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] beetl-parent ...................................... FAILURE [51.129s]
[INFO] beetl-core ........................................ SKIPPED
[INFO] beetl-performance ................................. SKIPPED
[INFO] beetl-samples ..................................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
升级之后,访问任意页面都是异常,看不错错在哪里,使用的JFinal1.6
>>加载模板错(TEMPLATE_LOAD_ERROR): 位于0行 资源:/account/signin.html
主要是发现preview的一个bug:
// 使用preview发现下面的两个结果都print为true。
${!msg!''==''}
${msg!''==''}
//这里发现一个问题,判断对象是否存在居然使用的是两个单引号' + '
// 而不是一个"(对比一下":''),感觉很奇怪,求解释。
看到2.0在线体验是正常的输出false,true,于是升级2.0-SNAPSHOP,升级后就无法使用了。看了一部分源码,没找到打印”加载模版错“这个地方,只是看到ext中jfinal的支持中BeetlRenderFactory改动了。
属性调用,内部抛异常后,应该像function调用那样,打印完整内部异常
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.