【问题标题】:Spring:message, No message found under code for locale 'en_US'Spring:消息,在语言环境“en_US”的代码下找不到消息
【发布时间】:2015-04-16 16:55:34
【问题描述】:

这是我在 spring-servlet.xml 中添加的内容

<bean id="messageSource"
        class="org.springframework.context.support.ResourceBundleMessageSource">
        <property name="basename" value="classpath:application"/>
    </bean>

我的 application.properties 文件位于 src/main/resources 文件夹中,但出现此异常

SEVERE: Servlet.service() for servlet [MVC-Dispatcher] in context with path [/MVCLayer] threw exception [javax.servlet.ServletException: javax.servlet.jsp.JspTagException: No message found under code 'Login_Username' for locale 'en_US'.] with root cause
javax.servlet.jsp.JspTagException: No message found under code 'Login_Username' for locale 'en_US'.
    at org.springframework.web.servlet.tags.MessageTag.doEndTag(MessageTag.java:200)

请帮忙看看配置有什么问题

【问题讨论】:

    标签: spring spring-mvc


    【解决方案1】:

    如果您将属性文件放在src/main/resources 文件夹中,则应使用value="application"

    当然还要确保application.properties 文件包含以Login_Username= 开头的行

    【讨论】:

    • 嘿,谢谢...这是我做的错误我认为...一旦我删除了类路径,它就起作用了...谢谢:)
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-05-16
    • 1970-01-01
    • 2021-01-19
    • 2013-02-10
    • 1970-01-01
    • 2012-06-11
    相关资源
    最近更新 更多