Solved

playing with jstl

Posted on 2007-04-04
7
395 Views
Last Modified: 2008-01-09
hi guys

I have something like this

<table>

<c:forEach var="docsummparty" items="${documentSummary.arrayList}" varStatus="DocPartycount">
               <tr valign="top" bgcolor="#ffffff">
            <td nowrap valign="top">


                 <c:out value='${DocPartycount.count}'/>
                    
               </td>
          </tr>
</c:forEach>
</table>



Now in the above code  the line " <c:out value='${DocPartycount.count}'/> "  displays the count number like 1 or 2 or 3.
Now, Instead of displaying the numbers like 1 or 2 or 3 , i want to display a, b, c, d, ..and so on.

I want to know if thats possible

Any help will be greatly appreciated

thanks in advance
Jay
0
Comment
Question by:jaggernat
  • 3
  • 2
  • 2
7 Comments
 
LVL 11

Expert Comment

by:Manish
ID: 18852148
I don't think , it is possible. You can compare with number and print a,b,c..
0
 
LVL 10

Author Comment

by:jaggernat
ID: 18852223
>>>You can compare with number and print a,b,c..

the same thing need to be done using  JSTL tags
0
 
LVL 11

Accepted Solution

by:
Manish earned 150 total points
ID: 18862483
I think, you can create list which contains a...z .
And access value from list by passing count..
<c:out value='${list[DocPartycount.count]}'/>
0
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 27

Assisted Solution

by:rrz
rrz earned 100 total points
ID: 18869642
Points to  karanw.  
Here is an example.  
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%
  String[] alpha = {"a","b","c","d","e"};
  request.setAttribute("alpha",alpha);
%>
<c:forEach var="docsummparty" items="jim,sam,ann,sally,jane" varStatus="DocPartycount">
                 ${alpha[DocPartycount.count - 1]}    
</c:forEach>
0
 
LVL 10

Author Comment

by:jaggernat
ID: 18870241
thanks both of you, i dint know you can print stuff out of an array in jstl, thats cool.

however
<%
  String[] alpha = {"a","b","c","d","e"};
  request.setAttribute("alpha",alpha);
%>
is there anyway i can represent the above code in jstl tags
something like  <c:set var="Array" value="['a', 'b', 'c....']"   scope="request" /> //not sure if this is correct..

any comments appreciated,
thanks guys
J
0
 
LVL 27

Expert Comment

by:rrz
ID: 18870828
>is there anyway i can represent the above code in jstl tags
I don't know how to do that. Maybe karanw knows a way. If you trying to avoid scriptlets then the easiest way would to use "tag files" . I assume you are using JSP 2.0 .
http://today.java.net/pub/a/today/2003/11/14/tagfiles.html
http://www.google.com/search?hl=en&q=%22tag+files%22+jsp
0
 
LVL 11

Expert Comment

by:Manish
ID: 18874558
No, I dont think it is possible.You have to create list and it should be in scope.
If you are using any bean, then you can transfer this code to bean
and get that list
like ${bean.abclist}  in jsp.
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

HOW TO: Upload an ISO image to a VMware datastore for use with VMware vSphere Hypervisor 6.5 (ESXi 6.5) using the vSphere Host Client, and checking its MD5 checksum signature is correct.  It's a good idea to compare checksums, because many installat…
In this article, you will read about the trends across the human resources departments for the upcoming year. Some of them include improving employee experience, adopting new technologies, using HR software to its full extent, and integrating artifi…
This video discusses moving either the default database or any database to a new volume.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now