简体   繁体   English

CSS样式有时仅在jsf页面上刷新页面后应用?

[英]CSS style sometimes only applied after a page refresh on a jsf page?

I've been struggeling a while with a strange bug in our application and wasn't able to find solution, even on google and stackoverflow i found nothing matching my problem. 我已经在我们的应用程序中遇到了一个奇怪的错误,并且无法找到解决方案,即使在谷歌和stackoverflow我发现没有任何匹配我的问题。

First, a short summary of the application setup: 首先,简要介绍应用程序设置:

  • ICEfaces 1.8.1 & JSF 1.2 ICEfaces 1.8.1和JSF 1.2
  • Seam 2.1.1 接缝2.1.1
  • Java 1.6, Update 20 Java 1.6,更新20
  • running on JBoss 4.2.2.GA 在JBoss 4.2.2.GA上运行
  • application is deployed as EAR-File 应用程序部署为EAR-File

If you need any additional information, please tell me, i will try to figure it out and provide it to you. 如果您需要任何其他信息,请告诉我,我会尽力解决并提供给您。

Now, here comes the problem: 现在,问题出现了:

Sometimes (at random pages in the application), the JSF-generated HTML-Code is created and send to the browser, but no stylesheets are included. 有时(在应用程序中的随机页面),创建JSF生成的HTML代码并将其发送到浏览器,但不包括样式表。 After a page refresh (hitting F5) the page is displayed as it should and all styles are applied. 页面刷新(按F5)后,页面将按原样显示,并应用所有样式。 On some pages, the error seems to be reproducable, on others it just occurs randomly. 在某些页面上,错误似乎是可重现的,而在其他页面上它只是随机出现。 The bug (?) occurs in Opera (11.51, no earlier versions tested) and Firefox (App works normally in 3.6, but not in Firefox 6). 错误(?)发生在Opera(11.51,没有测试的早期版本)和Firefox(App在3.6中正常工作,但在Firefox 6中没有)。 IE9 is working normally. IE9正常工作。

The site consists of a top level page (template.xhtml) forming the application layout, all other sites are included via ui:include-Tags. 该站点由形成应用程序布局的顶级页面(template.xhtml)组成,所有其他站点都包含在ui:include-Tags中。

Into the head-Tag, styles are included via 进入head-Tag,样式包括在内

<link href="#{request.contextPath}/stylesheet/icefaces_style.css" rel="stylesheet" type="text/css" />
<link href="#{request.contextPath}/stylesheet/screen.css"
rel="stylesheet" type="text/css" />

This renders to: 这使得:

Even if the page renders correct, stylesheets are not included into head, they are put into the body-tag, rendered as: 即使页面渲染正确,样式表也不会包含在头部中,它们会被放入body-tag中,呈现为:

<body>
<link type="text/css" rel="stylesheet" href="/myApp/stylesheet/icefaces_style.css">
<link type="text/css" rel="stylesheet" href="/myApp/stylesheet/screen.css">
</body>

If it doesn't render correct, simply no styles are included. 如果它不正确,则不包含任何样式。 Actually, nothing from the head-tag of template.xhtml page is included into the rendered response. 实际上,template.xhtml页面的head-tag中没有任何内容包含在呈现的响应中。

Do you have any suggestions where to look further or possible solutions? 您有什么建议在哪里寻找更多或可能的解决方案? Thanks in advance! 提前致谢!

I cannot find any JSF or expression language documentation that states whether expressions are allowed in the header or not. 我找不到任何JSF或表达式语言文档,说明标题中是否允许表达式。 But I have not seen expressions in the header before and am not surprised that ICEfaces is confused by it when processing the page. 但我之前没有在标题中看过表达式,并且在处理页面时ICEfaces对它感到困惑并不感到惊讶。 Move the CSS styles into the body and then the partial updates from ICEfaces to the web browser will work. 将CSS样式移动到正文中,然后从ICEfaces到Web浏览器的部分更新将起作用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM