NutzCN Logo
问答 不知道是beetl的问题 还是 集成的beetl的问题
发布于 656天前 作者 明天会吹什么风 941 次浏览 复制 上一个帖子 下一个帖子
标签: mvc beetl
      <nav class="page-bar">
        <?
        var pageNumber = obj.pager.pageNumber;
          var preNum = obj.pager.pageNumber-1;
          var nextNum = obj.pager.pageNumber+1;
          var hasNext =  nextNum == obj.pager.pageCount;
        ?>

          <?if(preNum>0){?>
            <a href="#">上一页</a>
          <?}?>
          <span class="cur">${pageNumber}</span>
          <?if(hasNext){?>
            <a href="${request.requestURL}?pageNumber=${nextNum}">下一页</a>
          <?}?>
      </nav>

这个页面第一次进入正常,刷新则出现如下异常:

ARRAY_INDEX_ERROR
	at org.beetl.core.om.ListAA.value(ListAA.java:59)
	at org.beetl.core.statement.VarAttribute.evaluate(VarAttribute.java:61)
	at org.beetl.core.statement.VarRef.evaluate(VarRef.java:127)
	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.BlockStatement.execute(BlockStatement.java:68)
	at org.beetl.core.statement.IfStatement.execute(IfStatement.java:63)
	at org.beetl.core.statement.Program.execute(Program.java:70)
	at org.beetl.core.Template.renderTo(Template.java:137)
	at org.beetl.core.Template.renderTo(Template.java:103)
	at org.beetl.ext.web.WebRender.render(WebRender.java:108)
	at org.beetl.ext.nutz.BeetlView.render(BeetlView.java:28)
	at org.nutz.mvc.impl.processor.ViewProcessor.process(ViewProcessor.java:55)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at org.nutz.mvc.impl.processor.MethodInvokeProcessor.process(MethodInvokeProcessor.java:28)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at org.nutz.mvc.impl.processor.AdaptorProcessor.process(AdaptorProcessor.java:33)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at org.nutz.mvc.impl.processor.ActionFiltersProcessor.process(ActionFiltersProcessor.java:40)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at vc.thinker.mvc.processor.DemoProcessor.process(DemoProcessor.java:28)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at vc.thinker.shiro.NutShiroProcessor.process(NutShiroProcessor.java:53)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at org.nutz.mvc.impl.processor.ModuleProcessor.process(ModuleProcessor.java:113)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at org.nutz.mvc.impl.processor.EncodingProcessor.process(EncodingProcessor.java:27)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at org.nutz.mvc.impl.processor.UpdateRequestAttributesProcessor.process(UpdateRequestAttributesProcessor.java:15)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at vc.thinker.mvc.processor.LogTimeProcessor.process(LogTimeProcessor.java:25)
	at org.nutz.mvc.impl.NutActionChain.doChain(NutActionChain.java:40)
	at org.nutz.mvc.impl.ActionInvoker.invoke(ActionInvoker.java:67)
	at org.nutz.mvc.ActionHandler.handle(ActionHandler.java:31)
	at org.nutz.mvc.NutFilter.doFilter(NutFilter.java:183)
	at vc.thinker.mvc.AppFilter.doFilter(AppFilter.java:47)
	at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1212)
	at com.alibaba.druid.support.http.WebStatFilter.doFilter(WebStatFilter.java:123)
	at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1212)
	at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:61)
	at org.apache.shiro.web.servlet.AdviceFilter.executeChain(AdviceFilter.java:108)
	at org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFilter.java:137)
	at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
	at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:66)
	at org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:449)
	at org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:365)
	at org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90)
	at org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83)
	at org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:383)
	at org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:362)
	at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
	at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1212)
	at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:399)
	at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
	at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
	at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766)
	at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:450)
	at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
	at org.mortbay.jetty.Server.handle(Server.java:326)
	at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
	at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:928)
	at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:549)
	at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212)
	at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
	at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:410)
	at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)
2015-10-12 16:44:46,810 org.beetl.ext.nutz.LogErrorHandler.processExcption(LogErrorHandler.java:32) DEBUG - 期望是整形或者是BigDecimal类型
>>04:44:46:数组index错(ARRAY_INDEX_ERROR):pageNumber 位于76行 资源:/front/company-list.html
期望是整形或者是BigDecimal类型
73|       ?>
74|
75|          <?if(preNum>0){?>
76|            <a href="#">上一页</a>
77|          <?}?>
78|          <span class="cur">${pageNumber}</span>
79|          <?if(hasNext){?>
7 回复

需要关闭静态类型检查,设置为动态变量类型
自豪地采用 NutzCN ionic

@guest 就是在模板的开头加入这一行

<%DIRECTIVE DYNAMIC;%>

beetl的这个配置没有全局开关,所以, 基本上每个模板都需要加, 做本网站的时候也是掉这个坑了

QQ截图20151013015553.png

当时跟beetl作者的对话截图 ^_^

beetl官方解释, 换成

ENGINE=org.beetl.core.engine.DefaultTemplateEngine

http://ibeetl.com/community/?/question/332

为毛线我老是遇到坑,生活也是。哈哈 ,吐嘈而已!

遇到相同坑,在这里找到答案,nice啊!
深坑啊

添加回复
请先登陆
回到顶部