【问题标题】:Play framework 1.2.5 template error播放框架1.2.5模板报错
【发布时间】:2013-10-15 16:57:31
【问题描述】:

请帮忙。尝试加载主页时出现以下错误:

Error during the 500 response generation

Template execution error (In /app/views/main.html around line 12)
Execution error occured in template /app/views/main.html. Exception raised was NullPointerException : null.

play.exceptions.TemplateExecutionException
    at play.templates.BaseTemplate.throwException(BaseTemplate.java:86)
    at play.templates.GroovyTemplate.internalRender(GroovyTemplate.java:272)
    at play.templates.GroovyTemplate.internalRender(GroovyTemplate.java:282)
    at play.templates.Template.render(Template.java:26)
    at play.templates.GroovyTemplate.render(GroovyTemplate.java:202)
    at play.server.PlayHandler.serve500(PlayHandler.java:774)
    at Invocation.HTTP Request(Play!)
Caused by: java.lang.NullPointerException
    at play.i18n.Messages.getMessage(Messages.java:97)
    at play.i18n.Messages.get(Messages.java:46)
    at play.templates.GroovyTemplate$ExecutableTemplate.__getMessage(GroovyTemplate.java:441)
    at /app/views/main.html.(line:12)
    at play.templates.GroovyTemplate.internalRender(GroovyTemplate.java:247)
    ... 5 more

这是我在 main.html 中的第 12 行: <span> &{"navTab.appName"}</span>
我有 conf/messages 文件和适当的密钥,但应用程序仍然看不到它

【问题讨论】:

    标签: templates playframework internationalization playframework-1.x


    【解决方案1】:

    我认为你的代码有一些问题。

    请在此处发布您的 main.html 代码,也许我可以提供帮助。

    另外,请在 Eclipse 中打开 Messages(Ctrl+T 并键入 Messages,找到包 play.i18n),然后检查第 97 行。确认您的代码是否使用默认 var?

    我用play framework 1.2.5很长时间,而且项目很大。这样没问题。

    【讨论】:

    • 如果您想了解更多信息或澄清,那么您应该在特定线程上发表评论。
    猜你喜欢
    • 1970-01-01
    • 2014-07-23
    • 1970-01-01
    • 2013-09-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-05-10
    • 1970-01-01
    相关资源
    最近更新 更多