File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSF and the fly likes Matrix display in JSF Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "Matrix display in JSF" Watch "Matrix display in JSF" New topic

Matrix display in JSF

Koushik Das

Joined: Sep 20, 2005
Posts: 4
I need to show a matrix using JSF in the following way .

. A B C
X 1 2 3
Y 4 5 6
Z 7 8 9

I'm having a table in database named "matrix" which is having 3 fields.
field1 is a number,field2 and field 3 are foreign keys which references to
table "A1" and table "X1".
A1 is having elements A,B,and C
X1 is having elements X,Y and Z
Elements of table MATRIX are as follows
field2 field3 field1
A X 1
A Y 4
A Z 7
B X 2
B Y 5
B Z 8
.. .... ..

Now I need to display the field1 of "matrix" table according to X and Y direction values(Those values are dynamic ones).

As h:datatable only supports X direction display, I thought I'll use any available GRID component for this kind of display.Unfortunately I couldnt get any faces component for this.

Is there any ready-made component available? Or do I need to write my own component for this? If so, can you guys help me by providing any similar kind of component which I can change for my requirement?
I am using a combination of JSF-Spring-Hibernate.

Please help me out.

[ October 17, 2006: Message edited by: Koushik ]
Ergin Er
Ranch Hand

Joined: Sep 06, 2005
Posts: 60
I'm having same type of problems. Als working on a matrix that needs to have a dynamic range of colums and rows (gatehered from lists generated for rows and colums) where the headers are not given and the whole matrix is filled with checkboxes that are checked/unchecked according to a listof results that need to be compared at each row/column cross section with the according column and row values from their lists.

the jsf components that are given feel complicated to use. Having experience with struts components doesn't help me out in any way.

Right now I'm trying to generate the whole matrix serverside using HtmlPanelGrid in java. Maybe that's an outcome for you?
Bert Bates

Joined: Oct 14, 2002
Posts: 8898
Hi Koushik,

Hang in there and I'm sure you'll get some good advice here, but in the meantime, please update your display name to match our naming policy, we've found things stay friendlier tha way.



Spot false dilemmas now, ask me how!
(If you're not on the edge, you're taking up too much room.)
Vinnie Jenks
Ranch Hand

Joined: Apr 26, 2004
Posts: 207
What about just using the JSTL <c:forEach> tag to lay things out exactly how you need them? I'm new to JSF but this is what I've done in what little I've used JSF for thus far.
It is sorta covered in the JavaRanch Style Guide.
subject: Matrix display in JSF
It's not a secret anymore!