我正在研究 Struts2 + Spring Application 并使用 Struts2 XML 验证来验证输入字段。验证适用于类型 - “requiredstring”,但是当我尝试验证类型 - “email”或“int”时,会出现此错误。请建议我克服这个问题。我正在使用 freemarker-2.3.19.jar。谢谢
ERROR [log.Log4JLoggerFactory$Log4JLogger].error() Template processing error: "Expression validator.expression is undefined on line 88, column 109 in template/xhtml/form-close-validate.ftl."
Expression validator.expression is undefined on line 88, column 109 in template/xhtml/form-close-validate.ftl.
The problematic instruction:
----------
==> ${validator.expression?js_string} [on line 88, column 107 in template/xhtml/form-close-validate.ftl]
in include "/${parameters.templateDir}/xhtml/form-close-validate.ftl" [on line 25, column 1 in template/xhtml/form-close.ftl]
程序员的 Java 回溯:
freemarker.core.InvalidReferenceException: Expression validator.expression is undefined on line 88, column 109 in template/xhtml/form-close-validate.ftl.
at freemarker.core.TemplateObject.assertNonNull(TemplateObject.java:125)
at freemarker.core.Expression.getStringValue(Expression.java:118)
at freemarker.core.Expression.getStringValue(Expression.java:93)
at freemarker.core.StringBuiltins$StringBuiltIn._getAsTemplateModel(StringBuiltins.java:71)
at freemarker.core.Expression.getAsTemplateModel(Expression.java:89)
at freemarker.core.Expression.getStringValue(Expression.java:93)
at freemarker.core.DollarVariable.accept(DollarVariable.java:76)
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)......................