我不清楚你的用例是什么;但从理论上讲,您可以使用任何给定组件上的<f:attribute/>
标签来传递参数。
的<f:attribute/>
标记添加到组件发起Ajax调用
<p:commandLink id="aComponent" value="#{bean.val}" action="#{bean.doSomething}">
<f:attribute name="conversationId" value="#{param['cid']}"/>
</p:commandLink>
你可以拉从组件参数图的参数支持bean:
FacesContext context = FacesContext.getCurrentInstance();
UIViewRoot theView = context.getViewRoot();
UIComponent component = theView.findComponent("aComponent");
Integer theConversationId =(Integer) component.getAttributes().get("cid");
这里的关键点是该参数可在#{param}
地图(与其他GET
参数一样)。它不会通过ajax自动传输的原因是:GET参数需要传输完整的HTTP请求。 AJAX的重点在于你可以选择发送给服务器的内容。