users@javaserverfaces.java.net

Re: dataTable of map

From: Raymond DeCampo <ray_at_decampo.org>
Date: Fri, 16 Apr 2010 19:03:25 -0400

On Fri, Apr 16, 2010 at 6:18 PM, Thufir <hawat.thufir_at_gmail.com> wrote:

> Raymond DeCampo <ray@...> writes:
>
> >
> >
> > If you use an array as the value in a <h:dataTable> it will use
> ArrayDataModel
> > transparently as the DataModel implementation.
>
> In the facelet you still need to specify rows and columns, right? Can't
> you
> pass meta-data describing the table?
>
>
>
Yes, you need to specify your columns. Rows are not specified, the
dataTable will iterate over your data model and include a row for each data
item based on the columns you specify.

I noticed below you have an <h:column> surrounding everything; <h:column>
only make sense in the context of an <h:dataTable>. Also, there is no need
for the <f:view> tag either.



>
>
> <?xml version='1.0' encoding='UTF-8' ?>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
> <html xmlns="http://www.w3.org/1999/xhtml"
> xmlns:ui="http://java.sun.com/jsf/facelets"
> xmlns:h="http://java.sun.com/jsf/html"
> xmlns:f="http://java.sun.com/jsf/core">
> <body>
> <ui:composition>
> <h:column>
> #{database.list}
> <f:view>
> <h:form>
> <h:dataTable id="Products"
> var="myProduct"
> value="#{database.list}"
> headerClass="topRow"
> summary="This table visually organizes
> product information and is used for layout only"/>
> <h:column>
> <f:verbatim><caption>Products
> displayed</caption></f:verbatim>
> </h:column>
> <h:column>
> <f:facet name="header"><h:outputText
> value="Name" /></f:facet>
> <h:outputText id="text1" value="#{
> database.name}" />
> </h:column>
> <h:column>
> <f:facet name="header"><h:outputText
> value="Number" /></f:facet>
> <h:outputText id="text2"
> value="#{database.number}" />
> </h:column>
>
> </h:form>
> </f:view>
> </h:column>
> </ui:composition>
> </body>
> </html>
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_javaserverfaces.dev.java.net
> For additional commands, e-mail: users-help_at_javaserverfaces.dev.java.net
>
>