File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSF and the fly likes MyFaces Tomahawk t:columns tag - basic example needed Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "MyFaces Tomahawk t:columns tag - basic example needed" Watch "MyFaces Tomahawk t:columns tag - basic example needed" New topic

MyFaces Tomahawk t:columns tag - basic example needed

Wally Hartshorn
Ranch Hand

Joined: Jan 30, 2003
Posts: 77
I'm so confused! Can someone explain to me how to use the MyFaces Tomahawk <t:columns> tag? The documentation is minimal, to say the least, and I can't seem to find a basic example anywhere. Most of the questions that I've found discussing it are asking about things like sorting and scrolling. All I need to know is how to use the tag at all.

Here's one version of what I've been trying.

Here's the output I wanted:

Here's the output I got:

Part of the JSP file:

Part of the Java code:

Should I be giving <t:dataTable> an array of data grouped as rows (which is what I tried first) or an array of data grouped as columns (which is what I'm trying in the above example)? In other words, should each array inside the ArrayList represent one row or one column?

What should <tutputText value="#{oneDay[rowIndex]}" /> really be? What I'm trying definitely isn't working! It apparently takes what I've specified and repeats it for each column. If I try to specify multiple <tutputText> tags (e.g. hard-coding oneDay[0], oneDay[1], oneDay[2], and oneDay[3]), it puts all of the results in a single cell, then repeats that cell. Not what I had in mind at all.

In some of the example snippets that I've seen, I've seen reference to something like <tutputText value="#{timecardForm.columnValue}">, but I've seen no explanation of where "columnValue is coming from. Presumably there's a call to a "getColumnValue" method, but I'm not sure how that method would know which value is needed next.

I'm obviously wildly missing the mark on this one. Can anyone point me in the right direction?

Thanks in advance!

Wally Hartshorn
Wally Hartshorn
Ranch Hand

Joined: Jan 30, 2003
Posts: 77
After posting my earlier message, I decided that perhaps the secret is writing a getColumnValue method.

The JSP code:

The code to initialize the sample data:

The code to return the proper value for this cell:

That works! Is that really how <t:columns> is supposed to be used? For example, I never use the "oneRow" variable that is created by <t:dataTable value="#{timecardForm.rows}" var="oneRow"> in the JSP. That seems a bit odd. Is that the preferred way of doing it?

Lastly, was there something somewhere that would have EXPLAINED this, saving me a day and a half of confused experimentation?
abhishekt tiwari

Joined: Jan 26, 2011
Posts: 15
I need your full java code for this displaying the calendar please
Leonardo Uribe

Joined: Jun 25, 2011
Posts: 4
There is an example of t:columns Here If you need a calendar in a table fashion check this example
I agree. Here's the link:
subject: MyFaces Tomahawk t:columns tag - basic example needed
It's not a secret anymore!