2

我正在研究 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)......................
4

1 回答 1

2

输入模板中没有这样的字段validator.expression。改为使用validator.regex。如果您不使用自定义模板,请下载干净一致无错误的 Struts 框架版本并将您的应用程序升级到最新版本。这将有助于克服解决应用程序的错误。

于 2013-09-21T11:28:27.973 回答