Results 1 to 2 of 2
Thread: Table Help
- 05-06-2007, 10:03 AM #1
Member
- Join Date
- May 2007
- Posts
- 6
- Rep Power
- 0
Table Help
Hi, i need to be able to alternate colours in my table. Such that the first row is blue, the second is yellow and so on. How can i implement it into my code?
Help will be greatly appreciated.
Java Code:<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> <html> <head> <title>Count to 10 Example(using JSTL)</title> </head> <body> <table border = 1 name = "index"> <c:forEach var="i" begin="1" end="5" step="1"> <tr> <td> <c:out value="${i}" /> </td> <td> <c:out value="${i*2}" /> </td> <td> <c:out value="${i*3}" /> </td> </tr> </c:forEach> </table> </body> </html>Last edited by levent; 05-06-2007 at 12:03 PM. Reason: [code] tag was missing. Added it to make the code more readable.
- 05-06-2007, 04:19 PM #2
Member
- Join Date
- Apr 2007
- Location
- Indiana
- Posts
- 83
- Rep Power
- 0
I can show you how I did that in struts, maybe you can conver the basic idea to your code. I defined a variable named color based on if the row number was odd or even.
This was all inside an iterator for a list that was displaying.Java Code:<bean:define id="counter" value='<%=ctr.intValue() % 2 + ""%>' /> <logic:equal name="counter" value="0"> <bean:define id="color" value="gray" /> </logic:equal> <logic:equal name="counter" value="1"> <bean:define id="color" value="white" /> </logic:equal>
then I had a stylesheet with that stye name in it such as
.white td {background: #fff;}
hth
Similar Threads
-
Hash Table help
By rhm54 in forum New To JavaReplies: 0Last Post: 02-08-2008, 01:25 AM -
Inserting into a table (Example)
By Java Tip in forum Java TipReplies: 0Last Post: 02-06-2008, 09:25 AM -
AWT Table Scrolling
By albert_kam in forum AWT / SwingReplies: 0Last Post: 01-03-2008, 11:37 AM -
regarding to creating table.....
By daredavil82 in forum New To JavaReplies: 0Last Post: 11-18-2007, 04:55 AM -
Help with multiplication table
By Albert in forum New To JavaReplies: 1Last Post: 07-10-2007, 04:44 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks