Basically, you need a data model whose structure is something like this:
I've omitted the grunt code (constructors, getters/setters) for clarity. You'd then build a collection (for example an arrayList) of ModelStats and a DataModel to wrap it. That is,
Since you're doing a tabular display, the View Template would follow the following form:
You have 2 choices for MAGIC_STUFF.
The first, and easiest overall is to add an aggregating property-get method to format the numbers as a single String that can be rendered via an h:outputText. That is:
This code may require tweaking, since you're dealing with a list of integers here.
The second method can be done without hacking the model element class:
As coded, this would print a trailing comma, but I think that you can use the ui:repeat varStatus attribute to control that.
The ui:repeat and h:dataTable are a lot alike, but h:dataTable renders as a 2-dimensional object with the elements arrayed in rows, whereas ui:repeat simply repeats its contents verbatim, leaving it up to you to do the actual layout. Also, h:dataTable employs a DataModel that can be queried in action code to determine which row the link, button, or AJAX control that was fired is in.
An IDE is no substitute for an Intelligent Developer.
posted 8 months ago
Thanks for Your post. I dont want to create new class. Is another option for example use map or some collection?