Solved

playing with jstl

Posted on 2007-04-04
7
403 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
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

Ready to get started with anonymous questions?

It's easy! Check out this step-by-step guide for asking an anonymous question on Experts Exchange.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Getting to know the threat landscape in which DDoS has evolved, and making the right choice to get ourselves geared up to defend against  DDoS attacks effectively. Get the necessary preparation works done and focus on Doing the First Things Right.
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

615 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