4
我需要獲取在我的Facelets文件中定義的隱藏變量的值,以處理我的bean中的事務。我在流程操作方法中使用了下面一行來獲取隱藏的輸入組件。但我得到null
。我怎樣才能得到指定的隱藏輸入值?JSF中的隱藏變量
豆子:
UIInput classNameComponent = (UIInput) event.getComponent().findComponent("className");
的觀點:
<ui:composition template="/templates/content.xhtml">
...
<h:form id="classForm">
...
<o:dataTable id="classTable">
...
<f:facet name="import">
<h:inputHidden id="className" value="com.LoadClass" />
</f:facet>
...
</o:dataTable>
...
</h:form>
...
</ui:composition>
即使您自己找到答案,也有更好的方法來實現這一點。我只需要首先知道您是使用JSF 1.x還是2.x(並且您在未來的JSF問題中應該提到這一點)。 – BalusC 2011-02-16 12:38:22