Q. How do I load data in a h:dataTable on a form load when I need to invoke a class which implements an javax.faces.event.ActionListener
e.g
public class TableListController implements ActionListener{
public void processAction(ActionEvent arg0)
throws AbortProcessingException {
//My logic goes here
}
}
Currently I have a button on the page which calls the above class, the question how do I do this on form load
//JSP Page has
<h:commandButton id="cmdGetTableList" value="Get Table List" actionListener="#{tableListController.processAction}" >
followed by
<h:form styleClass="form" id="frmTableList">
<h:dataTable width="100%" headerClass="headerRow"
rowClasses="searchoddRow, searchevenRow"
id="ctlItems2" rendered="#{TableListBean.viewTableList}"
value="#{TableListBean.tableListDTO}"
var="tableListDTO" >
<h:column>
<f:facet name="header"> <h:outputText value="Table Name" />
</f:facet>
<h:outputText value="#{tableListDTO.tableName}" />
</h:column>
<h:dataTable>
</h:form>
If someone has done this before please let me know.
Discussions
Web tier: servlets, JSP, Web frameworks: JSF:Loading a dataTable on a Form load using an ActionListener
-
JSF:Loading a dataTable on a Form load using an ActionListener (3 messages)
- Posted by: Balaji Ranganathan
- Posted on: April 05 2006 16:48 EDT
Threaded Messages (3)
- JSF:Loading a dataTable on a Form load using an ActionListener by Adam John on April 07 2006 20:26 EDT
- Using afterPhase() method by Balaji Ranganathan on May 03 2006 10:46 EDT
- JSF:Loading a dataTable on a Form load using an ActionListener by Alexandre Poitras on April 07 2006 20:31 EDT
-
JSF:Loading a dataTable on a Form load using an ActionListener[ Go to top ]
- Posted by: Adam John
- Posted on: April 07 2006 20:26 EDT
- in response to Balaji Ranganathan
You need to override the afterphase( ) method in the RESTORE_VIEW phase listener. -
Using afterPhase() method[ Go to top ]
- Posted by: Balaji Ranganathan
- Posted on: May 03 2006 10:46 EDT
- in response to Adam John
Could you give me an example of using the afterPhase() method. -
JSF:Loading a dataTable on a Form load using an ActionListener[ Go to top ]
- Posted by: Alexandre Poitras
- Posted on: April 07 2006 20:31 EDT
- in response to Balaji Ranganathan
Q. How do I load data in a h:dataTable on a form load when I need to invoke a class which implements an javax.faces.event.ActionListenere.g public class TableListController implements ActionListener{ public void processAction(ActionEvent arg0) throws AbortProcessingException { //My logic goes here }}Currently I have a button on the page which calls the above class, the question how do I do this on form load//JSP Page has <h:commandButton id="cmdGetTableList" value="Get Table List" actionListener="#{tableListController.processAction}" > followed by <h:form styleClass="form" id="frmTableList"> <h:dataTable width="100%" headerClass="headerRow" rowClasses="searchoddRow, searchevenRow" id="ctlItems2" rendered="#{TableListBean.viewTableList}" value="#{TableListBean.tableListDTO}" var="tableListDTO" > <h:column> <f:facet name="header"> <h:outputText value="Table Name" /> </f:facet> <h:outputText value="#{tableListDTO.tableName}" /> </h:column> <h:dataTable> </h:form>If someone has done this before please let me know.
Or better, use Struts Shale :)