Link to home
Start Free TrialLog in
Avatar of huzefaq
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>
Avatar of Kuldeepchaturvedi
Kuldeepchaturvedi
Flag of United States of America image

the code that u have written there should be doing it already..!
<tr>
   <c:forTokens items="${elements}" delims="," var="current">
   <td align="center" class="alt-color" >
       <c:out value="${current}" />
   </td>
   </c:forTokens>
</tr>
Avatar of Mayank S
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...:-)
Avatar of huzefaq
huzefaq

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
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..:-)
>> <td width="100">  </td>

BTW put it as a percentage, not absolute value.
Avatar of huzefaq

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
ASKER CERTIFIED SOLUTION
Avatar of Kuldeepchaturvedi
Kuldeepchaturvedi
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial