关注JEECG发展历程 关注最新动态和版本, 记录JEECG成长点滴 更新日志 - 技术支持 - 招聘英才

JEECG最新版本下载 JEECG智能开发平台 - 显著提高开发效率 常见问题 - 入门视频 - 参与开源团队

商务QQ: 69893005、418799587 商务热线(5*8小时): 010-64808099 官方邮箱: jeecgos@163.com

查看: 9615|回复: 0

[Online开发] 自己配置online填值规则一直出错

[复制链接]
发表于 2019-8-23 19:07:16 | 显示全部楼层 |阅读模式

如何解决自定义online填值规则配值一直出错?
后台代码:
public class CurrentDateFillRule2 implements IFillRuleHandler {
    @Override
    public String execute(String paramJson) {
        String pattern="yyyy-MM-dd";
        if(paramJson!=null && !"".equals(paramJson)){
            JSONObject jsonObject = JSONObject.fromObject(paramJson);
            Object obj = jsonObject.get("pattern");
            if(obj!=null)pattern=obj.toString();
        }
        SimpleDateFormat dateFormat=new SimpleDateFormat(pattern);
        return dateFormat.format(new Date());
    }
}
但是在进行前台功能测试,
前台录入信息展示不全面:

{0FE5A893-8506-47DC-8DB9-BFA3A38A4681}.png.jpg
后台报错,出现以下错误:
Expected method. data['${tableName}']['${po.field_name}']?if_exists?string evaluated instead to freemarker.template.SimpleScalar on line 233, column 207 in ceshi_add.
The problematic instruction:
----------
==> ${data['${tableName}']['${po.field_name}']?if_exists?string("yyyy-MM-dd")} [on line 233, column 205 in ceshi_add]
----------
Java backtrace for programmers:
----------
freemarker.template.TemplateException: Expected method. data['${tableName}']['${po.field_name}']?if_exists?string evaluated instead to freemarker.template.SimpleScalar on line 233, column 207 in ceshi_add.
at freemarker.core.TemplateObject.invalidTypeException(TemplateObject.java:136)
at freemarker.core.MethodCall._getAsTemplateModel(MethodCall.java:114)
at freemarker.core.Expression.getAsTemplateModel(Expression.java:40)
at freemarker.core.Expression.getStringValue(Expression.java:44)
at freemarker.core.DollarVariable.accept(DollarVariable.java:76)
at freemarker.core.Environment.visit(Environment.java:221)
at freemarker.core.ConditionalBlock.accept(ConditionalBlock.java:79)
at freemarker.core.Environment.visit(Environment.java:221)
at freemarker.core.MixedContent.accept(MixedContent.java:92)
at freemarker.core.Environment.visit(Environment.java:221)
at freemarker.core.IfBlock.accept(IfBlock.java:82)
at freemarker.core.Environment.visit(Environment.java:221)
at freemarker.core.MixedContent.accept(MixedContent.java:92)
at freemarker.core.Environment.visit(Environment.java:221)
at freemarker.core.IteratorBlock$Context.runLoop(IteratorBlock.java:179)
at freemarker.core.Environment.visit(Environment.java:428)
at freemarker.core.IteratorBlock.accept(IteratorBlock.java:102)
at freemarker.core.Environment.visit(Environment.java:221)
at freemarker.core.MixedContent.accept(MixedContent.java:92)
at freemarker.core.Environment.visit(Environment.java:221)
at freemarker.core.Environment.process(Environment.java:199)
at freemarker.template.Template.process(Template.java:259)
at org.jeecgframework.web.cgform.controller.build.CgFormBuildController.getTableTemplate(CgFormBuildController.java:418)
at org.jeecgframework.web.cgform.controller.build.CgFormBuildController.ftlForm(CgFormBuildController.java:362)
at org.jeecgframework.web.cgform.controller.build.CgFormBuildController.goAdd(CgFormBuildController.java:79)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:221)
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:137)
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:747)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:676)
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:938)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:870)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:961)


您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

快速回复 返回顶部 返回列表