Java 以下属性在requestScope中的什么位置&引用;requestScope.shouldRender“;
我请求使用primefaces,在这段remoteCommand代码中,我看到了#{requestScope.shouldRender},我感到困惑Java 以下属性在requestScope中的什么位置&引用;requestScope.shouldRender“;,java,jsf,jsf-2,Java,Jsf,Jsf 2,我请求使用primefaces,在这段remoteCommand代码中,我看到了#{requestScope.shouldRender},我感到困惑 <h:form id="form"> <p:commandButton value="Load" type="button" onclick="lazyload()" id="btnLoad" /> <p:outputPanel id="lazypanel" layout="block">
<h:form id="form">
<p:commandButton value="Load" type="button" onclick="lazyload()" id="btnLoad" />
<p:outputPanel id="lazypanel" layout="block">
<h:outputText value="This part of page is lazily loaded on demand using a RemoteCommand"
rendered="#{requestScope.shouldRender}"/>
</p:outputPanel>
<p:remoteCommand name="lazyload" update="lazypanel">
<f:setPropertyActionListener value="#{true}"
target="#{requestScope.shouldRender}" />
</p:remoteCommand>
我见过primefaces类与commandButton和remoteCommand相关,但我没有发现与shouldRender相关的内容。我有关于requestScope的搜索信息,但没有找到信息
如何调用“shouldRender”?是否有更多的属性/方法可以用相同的方式调用
种类。{requestScope}
引用了您可以通过获取的请求属性映射(如果您了解基本的Servlet API,这反过来又进一步委托)
下一行,
基本上,在调用父命令组件时,在当前请求中设置名为“shouldRender”且值为“true”的请求属性
输出文本的呈现属性只是在同一HTTP请求的呈现响应期间截取该属性:
rendered="#{requestScope.shouldRender}"
总之,这只是一种在请求范围内设置属性的方法,而不需要整个请求范围的支持bean。它的效果与
与
啊,setPropertyActionListener通过actionListener引入属性。关于setPropertyActionListener的文档我读错了。多谢各位
@ManagedBean
@RequestScoped
public class Bean {
private boolean shouldRender;
// Getter+setter.
}