【问题标题】:Struts validation errorStruts 验证错误
【发布时间】:2014-06-24 15:35:55
【问题描述】:

我正在为我的项目使用 struts 验证。我使用 maven 依赖项。我在 struts-config.xml 文件中添加了用于 struts 验证的插件。

当我添加value='/org/apache/struts/validator/validator-rules.xml'时,它显示错误:

cannot resolve symbol '/org/apache/struts/validator/validator-rules.xml'

我不知道这个错误。当我运行我的项目时,我得到invocationtarget exception

我不确定异常是由于这个问题还是任何其他问题而发生的。我已经搜索了很多以找到解决方案,但我失败了。下面是我在配置文件中添加的代码。请帮忙解决这个问题:

<plug-in className="org.apache.struts.validator.ValidatorPlugIn">
        <set-property property="pathnames"
            value="/org/apache/struts/validator/validator-rules.xml,/WEB-INF/conf/validation.xml" />
    </plug-in> 

【问题讨论】:

    标签: java xml validation maven configuration-files


    【解决方案1】:
    1. 从他的位置http://grepcode.com/file/repo1.maven.org/maven2/org.apache.struts/struts-core/1.3.9/org/apache/struts/validator/validator-rules.xml 下载validator-rules.xml 并添加到您的WEB_INF 位置。

    2. 下载 struts-core.jar 并将此 jar 文件添加到您的项目中。

    【讨论】:

    • 感谢您的回答,它奏效了。当我在值路径中包含“/org/apache/struts/validator/validator-rules.xml”时,它会显示错误。反正问题解决了。
    • 对 struts 核心的 Maven 依赖是 org.apache.strutsstruts-core1.3.10。也许对任何人都有帮助。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-28
    相关资源
    最近更新 更多