JSF 2 + RichFaces - 在托管 bean 中设置变量的问题
我有以下代码,每行上的 commandLink
应将 username
传递给 bean,但它传递 null。这是为什么? DataProviderBean
是SessionScoped
。
<h:form>
<rich:dataTable value="#{dataProviderBean.profileStats}" var="item"
id="statsTable">
<f:facet name="noData">No stats are available.</f:facet>
<rich:column filterValue="#{filteringBean.usernameFilter}"
filterExpression="#{fn:containsIgnoreCase(item.profile.username, filteringBean.usernameFilter)}">
<f:facet name="header">
<h:outputText value="Profile" />
<br />
<h:inputText value="#{filteringBean.usernameFilter}">
<a4j:ajax event="keyup" render="statsTable@body" execute="@this" />
</h:inputText>
</f:facet>
#{item.profile.username}
</rich:column>
<rich:column>
<f:facet name="header">AO Messages Count</f:facet>
#{item.aoMessagesCount}
</rich:column>
<rich:column>
<f:facet name="header">MO Messages Count</f:facet>
#{item.moMessagesCount}
</rich:column>
<rich:column>
<f:facet name="header">Administration</f:facet>
<a4j:commandLink execute="@this" render="@none"
oncomplete="#{rich:component('confirmPane')}.show()">
<h:graphicImage url="./resources/images/delete.png" alt="Delete" />
<a4j:param value="#{item.profile.username}"
assignTo="#{deleteStatsBean.username}" />
</a4j:commandLink>
</rich:column>
</rich:dataTable>
<a4j:jsFunction name="remove" action="#{deleteStatsBean.delete}"
render="statsTable" execute="@this"
oncomplete="#{rich:component('confirmPane')}.hide();" />
<rich:popupPanel id="confirmPane" autosized="true">
<h:outputText value="Are you sure you want to delete the profile statistics?" />
<br />
<a4j:commandButton value="Delete" onclick="remove(); return false;" />
<a4j:commandButton value="Cancel"
onclick="#{rich:component('confirmPane')}.hide(); return false;" />
</rich:popupPanel>
</h:form>
I have the following code and the commandLink
on each row should pass username
to the bean but it passes null. Why is that? The DataProviderBean
is SessionScoped
.
<h:form>
<rich:dataTable value="#{dataProviderBean.profileStats}" var="item"
id="statsTable">
<f:facet name="noData">No stats are available.</f:facet>
<rich:column filterValue="#{filteringBean.usernameFilter}"
filterExpression="#{fn:containsIgnoreCase(item.profile.username, filteringBean.usernameFilter)}">
<f:facet name="header">
<h:outputText value="Profile" />
<br />
<h:inputText value="#{filteringBean.usernameFilter}">
<a4j:ajax event="keyup" render="statsTable@body" execute="@this" />
</h:inputText>
</f:facet>
#{item.profile.username}
</rich:column>
<rich:column>
<f:facet name="header">AO Messages Count</f:facet>
#{item.aoMessagesCount}
</rich:column>
<rich:column>
<f:facet name="header">MO Messages Count</f:facet>
#{item.moMessagesCount}
</rich:column>
<rich:column>
<f:facet name="header">Administration</f:facet>
<a4j:commandLink execute="@this" render="@none"
oncomplete="#{rich:component('confirmPane')}.show()">
<h:graphicImage url="./resources/images/delete.png" alt="Delete" />
<a4j:param value="#{item.profile.username}"
assignTo="#{deleteStatsBean.username}" />
</a4j:commandLink>
</rich:column>
</rich:dataTable>
<a4j:jsFunction name="remove" action="#{deleteStatsBean.delete}"
render="statsTable" execute="@this"
oncomplete="#{rich:component('confirmPane')}.hide();" />
<rich:popupPanel id="confirmPane" autosized="true">
<h:outputText value="Are you sure you want to delete the profile statistics?" />
<br />
<a4j:commandButton value="Delete" onclick="remove(); return false;" />
<a4j:commandButton value="Cancel"
onclick="#{rich:component('confirmPane')}.hide(); return false;" />
</rich:popupPanel>
</h:form>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论