jeesite4.0 如果采用优化引擎,会假定传给模板的变量是同一类型,如果不是,请使用directive dynamic 变量

>>11:13:42:属性获取异常(ATTRIBUTE_INVALID):id 位于21行 资源:/modules/cs/csRepairStockinForm.html
属性访问出错
18|                            <div class="col-sm-8"> 
19|                                <#form:treeselect id="parent" title="${text('上级返修入库表')}" 
20|                                    path="parent.id" labelPath="parent.barCode" 
21|                                    url="${ctx}/cs/csRepairStockin/treeData?excludeCode=${csRepairStockin.id}" 
22|                                    class="" allowClear="true" canSelectRoot="true" canSelectParent="true"/> 
23|                            </div> 
24|                        </div> 

] with root cause
java.lang.ClassCastException: com.jeesite.modules.cs.entity.CsRepairStockin cannot be cast to com.jeesite.modules.cs.entity.CsRepairStockin

2019-03-18 11:13:42.183 ERROR 6404 --- [nio-8980-exec-8] error/500                                : ATTRIBUTE_INVALID

Caused by: java.lang.RuntimeException: com.jeesite.modules.cs.entity.CsRepairStockin cannot be cast to com.jeesite.modules.cs.entity.CsRepairStockin如果采用优化引擎,会假定传给模板的变量是同一类型,如果不是,请使用directive dynamic 变量;来避免

修改core项目下beetl-core.properties
参考:http://ibeetl.com/guide/beetl.html#_spring_boot

5.8.3 错误提示里有“directive dynamic “ Beetl使用FastRuntimeEngine有可能导致这个问题

ENGINE=org.beetl.core.engine.FastRuntimeEngine
这个引擎会假设同一个模板里的同一个全局变量应该类型唯一,如果你的模板是公共模板,类型不一样,可以在模板顶部使用dynamic,比如

<% directive dynamic xxx %> 如果你的模板这种情况很多,建议更换成默认引擎配置

ENGINE=org.beetl.core.engine.DefaultTemplateEngine 还有种情况是在Spring Boot
下出现,参考下一节

发布了100 篇原创文章 · 获赞 106 · 访问量 27万+

猜你喜欢

转载自blog.csdn.net/lglglgl/article/details/88635578
今日推荐