在project_stage开发中的加载期间,JSF页面闪烁 [英] JSF page flashes during load while in project_stage development

查看:53
本文介绍了在project_stage开发中的加载期间,JSF页面闪烁的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个JSF页面,其中包含9个InputText框和2个InputSecret框.每个框都有一个连接到属性文件的标签,一个验证器(带有消息),并包含一个连接到Named会话作用域bean的EL表达式.我正在使用Glassfish 3.1.2.1作为应用程序服务器.如果将project_stage设置为开发",则在加载或刷新此页面时会看到明显的闪烁.它发生得非常快,但是看起来好像是在加载页面之前将background(body)清除为白色.如果将项目阶段设置为生产",则看不到闪烁.Project_Stage开发正在做什么,从而导致此行为?

I have a JSF page with 9 InputText boxes, and 2 InputSecret boxes. Each of these boxes has a label connected to a properties file, a validator(with a message), and contains an EL expression connected to a Named session scoped bean. I'm using Glassfish 3.1.2.1 as the application server. If I have the project_stage set to Development, I see a noticeable flash when this page is loaded or refreshed. It happens very quickly, but it appears as if the background(body) is being cleared to white before the page is loaded. If I set the project stage to Production, I do not see the flash. What is Project_Stage development doing that causes this behavior?

推荐答案

这是浏览器特定的行为,当从HTTP响应接收到的第一个字节和最后一个字节之间花费一些时间时.一些浏览器在接收到第一个字节时会清空,而在接收到最后一个字节时会完整显示新页面.人眼的帧速率约为25fps(使用电视时).任何比这更快的速度,人类都不会注意到.但是,任何比这更慢的事情都会导致遮挡可见.

This is browser specific behaviour when it takes some time between the first byte and the last byte received from the HTTP response. Some browsers blanks out when the first byte is received and presents the new page in its entirety when the last byte is received. The human eye has a frame rate of about 25fps (as television is using). Anything which goes faster than that isn't noticeable to humans. But anything which goes slower than that causes the blankout to be visible.

在开发阶段将不缓存某些部分,以便立即看到源文件中所做的最新更改,例如Facelets源文件.它们都是根据每个请求重新编译和重新解析的.所有这些都会导致页面加载时间花费更长的时间,因此,当浏览器出现空白的时间超过大约1/25秒时,就会很快看到该空白.

The development stage causes some parts to be not cached so that the latest changes made in source files are immediately visible, such as Facelets source files. They are all re-compiled and re-parsed on a per-request basis. All of this causes the page load time to take a little longer and therefore the browser blankout to be shortly visible when it appears longer than about 1/25 second.

您可能要考虑将 web.xml 中的Facelets缓冲区大小增加到最大HTML输出的大小,以便一次性发送响应,而不是部分发送需要更多的预处理时间.

You may want to consider to increase the Facelets buffer size in web.xml to about the size of your largest HTML output, so that the response is sent in one go instead of in parts which may require some more pre-processing time.

例如64KB:

<context-param>
    <param-name>javax.faces.FACELETS_BUFFER_SIZE</param-name>
    <param-value>65535</param-value> <!-- 64KB -->
</context-param>

这篇关于在project_stage开发中的加载期间,JSF页面闪烁的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆