aspose file troubles
The moose likes Struts and the fly likes logic:iterate question The Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Application Frameworks » Struts
Reply Bookmark "logic:iterate question" Watch "logic:iterate question" New topic
Author

logic:iterate question

Chris Stann
Ranch Hand

Joined: Oct 10, 2006
Posts: 47
I'm using logic:iterate to build rows and cells of a table.



The outer iterator creates my rows and the inner creates my cells.

The trouble is that I want cells in the first column to be aligned to left and the rest aligned to right. How can I do this?

[ October 31, 2008: Message edited by: Chris Stann ]
[ October 31, 2008: Message edited by: Chris Stann ]

EXCEL IN ALL YOU DO
Vinod K Singh
Ranch Hand

Joined: Sep 30, 2008
Posts: 198
Create a local variable and reset that to 0 before entering in inner loop and keep on incrementing it there. That way you will know when first column is being written and align that accordingly.

My Blog
Jeanne Boyarsky
internet detective
Sheriff

Joined: May 26, 2003
Posts: 18884
Chris,
Better still would be store the values in a form that represents what they are. If you have a specific object, it would be better to have the fields named (ex-Book has a title, author, ISBN, etc) and reference those without going through a loop.

If you have some generic query and the first column is a title/label, you could have a Row object with a String title/label and Collection for the rest.

There must be something special about that first column for it to be displayed differently. And it's better for you model to know about it than force the view to handle it. (Java code in a JSP is an anti-pattern which should get you to think about whether things are designed in the best possible way.)

[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]

"The set strikes me as something like the set of potatoes, radishes, farming, and lunch. " - a colleague's way of comparing both overlapping and disparate groups. made me laugh and thought of the ranch
Chris Stann
Ranch Hand

Joined: Oct 10, 2006
Posts: 47
It has been a while since the original post but I wanted to update with my solution, for posterity.

I ended up using indexId which is used to index the columns within a table. If you look below, the solution is rather elegant, if I say so myself. :-)

Alejandro Galvan
Ranch Hand

Joined: Jan 02, 2008
Posts: 48
Hi,

Have you tried Displaytag? it gives you a table from a list previosly setted in the request scope, it can show all the attributes, or just what you defined, in columns, check it at: its site

Good luck,

SCJP 5.0<br />Preparing SCWCD
 
aspose file troubles
 
subject: logic:iterate question
 
IntelliJ open source

.