自己配置online填值规则一直出错
如何解决自定义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());
}
}
但是在进行前台功能测试,
前台录入信息展示不全面:
后台报错,出现以下错误:
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")}
----------
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)
页:
[1]