jsf and datatable
hello,
i have a problem with <h:dataTable/>
i just want to give out some data in a table:
my jsf-file has such one code:
<h:dataTable id="items" value="#{xmlDatas.hotelTable}" var="hotelLocation">
<h:column>
<f:facet name="header">
<h:outputText value="Location"/>
</f:facet>
<h:outputText value="#{hotelLoc.hotelLocation}"/>
</h:column>
my xmlDatas-Bean has this code:
private DataModel hotelModel =new ListDataModel();
ArrayList<HotelLocation> tempData =new ArrayList<HotelLocation>();
public DataModel getHotelTable(){
for(int i = 0; i < getResultCount(); i++)
{
tempData.add(new HotelLocation(getResult(i).getServiceDesc()));
}
hotelModel.setWrappedData(tempData);
return hotelModel;
}
getServiceDesc() gives me information about hotels. My HotelLocation-class gets the hotels, but the output in jsf-file is empty. Where could be here the mistake?
[1577 byte] By [
naekoa] at [2007-11-27 1:09:47]

# 2
i have one bean more (hotelLoc)
class HotelLocation()
{
public HotelLocation(String hotelLocation)
{
this.hotelLocation = hotelLocation;
}
public String getHotelLocation() {
return hotelLocation;
}
public void setHotelLocation(String hotelLocation) {
this.hotelLocation = hotelLocation;
}
}
naekoa at 2007-7-11 23:45:05 >

# 3
The datatable works as follows:
<h:dataTable value="#{myBean.list}" var="item">
<h:column><h:outputText value="#{item.value}" /></h:column>
</h:dataTable>
Where MyBean#getList() returns List<Item> (or for example ListDataModel(List<Item>), if you want) and the Item DTO contains a property "value" which can be retrieved by Item#getValue().
Also check http://balusc.xs4all.nl/srv/dev-jep-dat.html how to use datatables.
# 4
thanks for the link
This was my mistake:
instead of
<h:dataTable id="items" value="#{xmlDatas.hotelTable}" var="hotelTable">
<h:column>
<f:facet name="header">
<h:outputText value="Location"/>
</f:facet>
<h:outputText value="#{hotelLoc.hotelLocation}"/>
</h:column>
->
<h:dataTable id="items" value="#{xmlDatas.hotelTable}" var="hotelLocationItem">
<h:column>
<f:facet name="header">
<h:outputText value="Location"/>
</f:facet>
<h:outputText value="#{hotelLocationItem.hotelLocation}"/>
</h:column>
naekoa at 2007-7-11 23:45:05 >

# 6
its solved:-)
i get all my data i want.
So i would like to split my resultlist (to show not the whole list, but only 10 of them and the rest could be chosen by link):
myData:
*1
*2
*3
*4
*5
*6
*7
*8
*9
*10
Here the links:
12345 (depending on the size of resultlist)
are there any examples for this undertaking?
naekoa at 2007-7-11 23:45:05 >

# 8
ok, thank you.
i have a very weird situation in my project.
I have a one jsf-page:
<html>
<f:view>
<head></head>
<body>
<h:panelGrid>
<h:panelGroup id="datanavi">
<jsp:include page="datanavi.jsp"></jsp:include>
</h:panelGroup>
</h:panelGrid>
</body>
</f:view>
</html>
in this page i include other one (datanavi.jsp)
this has following structure:
<h:form>
<h:panelGrid>
<h:column>
<h:outputText/>
</h:column>
..........
</h:panelGrid>
<h:commandButton id="dbconnect1" action="#{xmlDatas.buildXML}" value = "Send"></h:commandButton>
<h:panelGroup id="navi2" rendered="#{xmlDatas.showHotelDetails == true}">
<jsp:include flush="true" page="datanavi_hotels.jsp"></jsp:include>
</h:panelGroup>
</h:form>
as one can see i include other site, which is only shown if a flag is set. This flag will be set in buildXML-function.
The datanavi_hotels.jsp looks like:
<h:form>
<h:dataTable value="#{xmlDatas.hotelTable}">
...****here the data of hotelTable***
</h:dataTable>
</h:form>
so.....whatever i do in datanavi.jsp i always come in hotelTable() function, although i expect to get into buildXML() method.
What could be a problem?
naekoa at 2007-7-11 23:45:05 >
