我们正在使用JSF和Primefaces控制Tomcat上运行的Web应用程序中的SparkStream。当我们启动或停止此流时,Web GUI持续加载大约需要15秒。
现在,我们希望对长时间加载内容使用延迟加载,以确保即使Bean需要一些时间来响应,Web GUI仍然可以访问。无论如何,如果我们这样做,我们的p:inputSwitch就不能正常工作了。
每次加载或刷新页面时,Bean中的值都设置为false。
<h:form>
<p:panel id="control" header="Streaming-Control" collapsed="false" toggleable="true">
<p:outputPanel deferred="true">
<p:inputSwitch id="test" value="#{SomeBean.someBoolean}">
<p:ajax update="test"/>
</p:inputSwitch>
</p:outputPanel>
</p:panel>
</h:form>
我们需要将inputSwitch放在延迟的outputPanel中,因为在整个页面完全呈现之前,它不应该被访问(这意味着流正在运行或停止,但不是启动或停止atm)。
PrimeFaces版本为6.0。