问题描述
我遇到了一个讨厌的primefaces-bug.我有2个用于更改语言的commandLinks:
I'm faced with an annoying primefaces-bug. I have 2 commandLinks for changing languages:
<p:commandLink action="#{language.setLanguage('de')}"
ajax="false">
<h:graphicImage value="/resources/images/flags/germany.png"
style="vertical-align: middle;width:40px;height:34px" />
</p:commandLink>
如果我现在更改语言环境,则页面将重新加载,但素数替代似乎已消失.至少文本要大一些……这是一个声名狼藉的问题吗?
if I change the locale now, the page is reloaded but it seems like the primefaces overrides are gone. At least the texts are bigger... Is this a familliar issue?
致谢
推荐答案
我本来应该发表评论,而不是发布答案,但我缺乏要点:).
I would have just commented, rather than posting an answer but I'm lacking the points :).
如果更改区域设置时样式消失了,我怀疑可能是您的资源定位器造成的.根据JSF 2.1规范,第2.6.1.3节( JSR-000314 )资源标识符可以包含以下元素
If you are seeing styles disappearing when changing locale, I suspect is it your resource locator that may be the cause. Per JSF 2.1 specification, Section 2.6.1.3 (JSR-000314) a resource identifier can consist of the following elements
[localePrefix/][libraryName/][libraryVersion/]resourceName[/resourceVersion]
假设您有样式表app.css
,使用
<h:outputStyleSheet library="css" name="app.css" />
将在<root>/resources/css/app.css
上找到资源.我怀疑如果您以编程方式将本地更改为默认语言环境以外的其他语言,例如意大利语(即it
),那么JSF会在<root>/resources/it/css/app.css
中寻找您的资源.这只是预感.我最近才开始研究进行本地化所需的内容,并且回想起JSF可以组织特定于语言环境的资源.
would locate the resource at <root>/resources/css/app.css
. I suspect if you programmatically change the local to something other than your default locale, say Italian (i.e. it
), then JSF will look for your resource in <root>/resources/it/css/app.css
. Its only a hunch. I just recently started looking at what is requires to do localization and I recalled JSF having a means to organize locale-specific resources.
这篇关于非Ajax刷新后Primefaces覆盖不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!