huzefaq
asked on
using JSTL how to put data in different <td> tags
Hi Guys
I have a JSTL code which separates a String using the delimeter (,) and put the data in one <td>
But what I need is that the separated data be placed in different <td>
Any help will be greatly appreciated
Thanks
<tr>
<c:forTokens items="${elements}" delims="," var="current">
<td align="center" class="alt-color" >
<c:out value="${current}" />
</td>
</c:forTokens>
</tr>
I have a JSTL code which separates a String using the delimeter (,) and put the data in one <td>
But what I need is that the separated data be placed in different <td>
Any help will be greatly appreciated
Thanks
<tr>
<c:forTokens items="${elements}" delims="," var="current">
<td align="center" class="alt-color" >
<c:out value="${current}" />
</td>
</c:forTokens>
</tr>
What is the problem you are facing?
Your code already does what you have requested in your question. Please restate your question.
Sorry, Kuldeepchaturvedi, I didn't see your comments.
:-) not a problem..... happens with all of us...:-)
ASKER
Guys you are right it actually does what I was trying to do.
But there is another small problem, what I need is to manage the width of different table columns
For example the <td> should be like this
<td width="100"> </td>
<td width="400"> </td>
<td width="150"> </td>
Would you guys know how can I do this, beacuse right now I am not able to set the width of different columns. Thanks
But there is another small problem, what I need is to manage the width of different table columns
For example the <td> should be like this
<td width="100"> </td>
<td width="400"> </td>
<td width="150"> </td>
Would you guys know how can I do this, beacuse right now I am not able to set the width of different columns. Thanks
put the counter and give width as per your requirement.
from where these width numbers are suppose to come? is it hard coded? or they are coming from the collection itself?
you need to give us a little more detail so that we can provide the right logic for the same..:-)
you need to give us a little more detail so that we can provide the right logic for the same..:-)
>> <td width="100"> </td>
BTW put it as a percentage, not absolute value.
BTW put it as a percentage, not absolute value.
ASKER
Actually to the following code this line is passed
56, this a kitchen ware, 62C
<c:forTokens items="${elements}" delims="," var="current">
<td align="center" class="alt-color" >
<c:out value="${current}" />
</td>
</c:forTokens>
now this code puts the three different values in three different td's but I need to hard code the width. For the first column 200 px, For the second 400 px and for the third 150 px.
Thanks guys for all your help
56, this a kitchen ware, 62C
<c:forTokens items="${elements}" delims="," var="current">
<td align="center" class="alt-color" >
<c:out value="${current}" />
</td>
</c:forTokens>
now this code puts the three different values in three different td's but I need to hard code the width. For the first column 200 px, For the second 400 px and for the third 150 px.
Thanks guys for all your help
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
<tr>
<c:forTokens items="${elements}" delims="," var="current">
<td align="center" class="alt-color" >
<c:out value="${current}" />
</td>
</c:forTokens>
</tr>