Sitemesh spring:模板中无法识别消息
我们在 Sitemesh 2 的项目中使用 spring:message 标签。 当在装饰器中使用 spring:message 时,无法识别 -tag 。我们可以在 jsp 页面中但在装饰器 jsp 文件中使用 -tag。
<?xml version="1.0" encoding="UTF-8"?>
<excludes/>
<page-parsers>
<parser content-type="text/html" encoding="UTF-8" class="com.opensymphony.module.sitemesh.parser.FastPageParser" />
</page-parsers>
<decorator-mappers>
<mapper class="com.opensymphony.module.sitemesh.mapper.ConfigDecoratorMapper">
<param name="config" value="${decorators-file}" />
</mapper>
</decorator-mappers>
如果我们使用已弃用的解析器 FastPageParser 则没有问题,但是当使用新的 HTMLPageParser 时则不起作用。
我们该如何解决这个问题呢?
We are using the spring:message tag in a project with Sitemesh 2.
When using the spring:message in the decorator than the -tag isn't recognized. We can use the -tag in our jsp pages but in the decorator jsp file.
<?xml version="1.0" encoding="UTF-8"?>
<excludes/>
<page-parsers>
<parser content-type="text/html" encoding="UTF-8" class="com.opensymphony.module.sitemesh.parser.FastPageParser" />
</page-parsers>
<decorator-mappers>
<mapper class="com.opensymphony.module.sitemesh.mapper.ConfigDecoratorMapper">
<param name="config" value="${decorators-file}" />
</mapper>
</decorator-mappers>
If we use the deprecated parser FastPageParser than there is no problem, but when using the new HTMLPageParser than is doesn't work.
How can we solve this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用 FastPageParser 的装饰器对我来说效果很好。
有几件事需要检查..
您的装饰器中是否包含 springframework 和 sitemesh 标记库?
所以在 sitemesh.xml 中:
CustomConfigDecoratorMapper 看起来像这样:
除此之外..您是否考虑过使用 fmt:message 代替?
Works fine for me on decorators using FastPageParser.
A couple of things to check..
Are you including the springframework and sitemesh taglibs on your decorators?
I'm not sure if it will make a difference to the filter chain, but I'm using a custom configdecorator mapper that chooses the decorator based on a layout set in the request scope.
So in sitemesh.xml:
CustomConfigDecoratorMapper look's like this:
Other than that.. have you considered using fmt:message instead?