<h:dataTable styleClass="dataTable" id="list" value="#{PostCodeBean.postCodeList}" var="plist" rows="10" >
<f:facet name="footer">
<hx:panelBox styleClass="panelBox" id="box1">
<hx:pagerWeb styleClass="pagerWeb" id="web1" />
</hx:panelBox>
</f:facet>
<h:column>
<h:selectBooleanCheckbox styleClass="selectOneRadio" id="pcheck" value="#{plist.postCodeValue}"></h:selectBooleanCheckbox>
</h:column>
<h:column>
<f:facet name="header">
<h:outputText styleClass="outputText" value="Post Code" ></h:outputText>
</f:facet>
<h:outputText id="postCodeValue" value="#{plist.postCodeValue}" />
</h:column>
<h:column></h:column>
<h:column>
<f:facet name="header">
<h:outputText styleClass="outputText" value="City Name"></h:outputText>
</f:facet>
<h:outputText id="postCodeArea" value="#{plist.postCodeArea}" />
</h:column>
</h:dataTable>
i am using this code in jsp to display the values.
when i select one row and click on button, i want to display that values in next jsp.
kindly give the idea how to get the selected value in java class.
-
HtmlDataTable in jsf (4 messages)
- Posted by: Siva Devendra
- Posted on: April 01 2005 00:46 EST
Threaded Messages (4)
- HtmlDataTable in jsf by Robert Winkler on April 02 2005 05:07 EST
- probelem with datatable by Siva Devendra on April 05 2005 03:15 EDT
-
probelem with datatable by Duncan Mills on April 06 2005 08:12 EDT
- Problem with datatable by Jive User on July 09 2008 01:30 EDT
-
probelem with datatable by Duncan Mills on April 06 2005 08:12 EDT
- probelem with datatable by Siva Devendra on April 05 2005 03:15 EDT
-
HtmlDataTable in jsf[ Go to top ]
- Posted by: Robert Winkler
- Posted on: April 02 2005 05:07 EST
- in response to Siva Devendra
You need a binding to the dataTable
<h:dataTable styleClass="dataTable" id="list" value="#{PostCodeBean.postCodeList}" var="plist" rows="10"
binding="#{PostCodeBean.postCodeTable}">
Java Code:
private UIData postCodeTable;
<- setter and getter for this variable ->
then you can access the selected row with:
Object selectedObject = (Object) postCodeTable.getRowData(); -
probelem with datatable[ Go to top ]
- Posted by: Siva Devendra
- Posted on: April 05 2005 03:15 EDT
- in response to Robert Winkler
i used the following code to display the list of values using datatable. after that i want to select one row and click on ok then i want get that perticular row data in java class.
but i got javax.faces.el.EvaluationException: java.lang.IllegalArgumentException when i am trying to call getRowData methos from UIData object.
<h:dataTable styleClass="dataTable" id="list" value="#{PostCodeBean.postCodeList}" var="plist" rows="10"
binding="#{PostCodeBean.postCodeTable}">
and having the getter and setter methods of UIData type varialbe in PostCodeListBean
i wrote the follwing code in selectPostCode() method of PostCodeListBean class and when i click on ok buttom in jsp i am calling this methd.but i got java.lang.IllegalArgumentException
Object selectedObject = (Object) postCodeTable.getRowData();
Thanks
Siva -
probelem with datatable[ Go to top ]
- Posted by: Duncan Mills
- Posted on: April 06 2005 08:12 EDT
- in response to Siva Devendra
Have you defined the postCodeTable as HtmlDataTable? getRowData is a method on that...
Here's a sample that I happen to have which does this:
private HtmlDataTable _dataTable;
public void setDataTable(HtmlDataTable dataTable)
{
this._dataTable = dataTable;
}
public HtmlDataTable getDataTable()
{
return _dataTable;
}
public String editLinkAction()
{
/* pull out the currently selected contact */
Contact editContact = (Contact)this.getDataTable().getRowData();
FacesContext ctx = FacesContext.getCurrentInstance();
ValueBinding binding = ctx.getApplication().createValueBinding("#{editContact}");
binding.setValue(ctx,editContact);
return "drilldown";
}
(You can see the related stuff here if you are interested) -
Problem with datatable[ Go to top ]
- Posted by: Jive User
- Posted on: July 09 2008 13:30 EDT
- in response to Duncan Mills
Hi, I folloewed your suggestions to select a row from h:datatable and manipulate the selected records at the back end bean. Unfortunately, the getRowData() or getRowInder(), is throwing an " javax.faces.el.EvaluationException: java.lang.IllegalArgumentException" error. I used the same code as given beow. I also tried to get only the getrowIndexx() and it is returning -1 Please let me know Thanks Aish