GeeCON Prague 2014*
The moose likes JSP and the fly likes forEach tag begin equals end issue Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » JSP
Bookmark "forEach tag begin equals end issue" Watch "forEach tag begin equals end issue" New topic
Author

forEach tag begin equals end issue

Karthik Rajendiran
Ranch Hand

Joined: Aug 13, 2004
Posts: 211
Hello Friends
I have a condition issue in foreach tag

<c:forEach items="${size}" end="3" >
<cut value="HELLO"/>
</c:forEach>

If the begin is equal to end tag, the loop doesnt execute.
If i give begin as 2 and end as 3, the loop executes twice,but i want it to execute one time, in such case

How to do this with foreach

Kindly help


SCJP 1.4 SCWCD 1.4 SCDJWS 1.4
Bosun Bello
Ranch Hand

Joined: Nov 06, 2000
Posts: 1510
You may want to check out the jstl reference to see exactly how it handles it.


Bosun (SCJP, SCWCD)
So much trouble in the world -- Bob Marley
Shrenik Sakriya
Ranch Hand

Joined: May 07, 2001
Posts: 40
Pls. give end="0" ... Should work . But even if you give begin & end same at least one should be printed.


SCJP1.2 88%<br />SCWCD1.4 89%<br />CCNA 94%
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61315
    
  66

Originally posted by Shrenik Sakriya:
Pls. give end="0" ...


"Pls" is not a word. Please use only real words such as "please" when posting to the forums.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Karthik Rajendiran
Ranch Hand

Joined: Aug 13, 2004
Posts: 211
Hello Friends,

<c:set var="x" value="3"/>
<c:forEach begin="${x}" end="3">
<cut value="${x}"/>
</c:forEach>

Surprisingly,code inside the body doesnt even execute once.
Karthik Rajendiran
Ranch Hand

Joined: Aug 13, 2004
Posts: 211
Hello Friends
As per jakarta implementation, the code is works with one time entry
I am using resin 2.x with jakartha jstl.
I am getting that issue in resin and not in tomcat.
Anybody can help ?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61315
    
  66

The problem does not manifest itself in resin 3 with its builtin JSTL implementation.
 
GeeCON Prague 2014
 
subject: forEach tag begin equals end issue