aspose file tools*
The moose likes JSP and the fly likes c:forEachToken Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "c:forEachToken" Watch "c:forEachToken" New topic
Author

c:forEachToken

Mijeong Yi
Greenhorn

Joined: Feb 12, 2006
Posts: 4
make use of <c:forEachToken>

select box create==========

<c:set var="setNum1"><c ut value="${fNum1}" /></c:set>

<select name="sNum">
<c:forEachToken var="num" items="00001/00002/00003/00004" delims="/">
<option value=" " <if test="{setNum1 == [num value]}"> selected </c:if>>
<c ut value="${num}" />
</option>
</c:forEachToken>
</select>


// help me!!
[num value]is array num[i] in JAVA.
but, JSTL express it.

[ February 12, 2006: Message edited by: Mijeong Yi ]

[ February 12, 2006: Message edited by: Mijeong Yi ]
[ February 12, 2006: Message edited by: Mijeong Yi ]
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14688
    
  16

If you are talking about c:forTokens, you should use "num" to check the value :
<c:if test="${setNum1 == num}">


[ February 12, 2006: Message edited by: Satou kurinosuke ]

[My Blog]
All roads lead to JavaRanch
Mijeong Yi
Greenhorn

Joined: Feb 12, 2006
Posts: 4
compare setNum1 with each items.

setNum1 compare 00000
setNum1 compare 00001
:
:

I Can't speak english well. I'm sorry....
[ February 12, 2006: Message edited by: Mijeong Yi ]
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14688
    
  16

I Can't speak english well. I'm sorry....

It's ok. Me either

Have a look at the piece of code I have posted above,
and tell me what you think about it.
It compares setNum1 to each token taken from the list.
If it matches, the option will be selected.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61424
    
  67

"dawn sky",

There aren't many rules that you need to worry about here on the Ranch, but one that we take very seriously regards the use of proper names. Please take a look at the JavaRanch Naming Policy and adjust your display name to match it.

In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.

Thanks!
bear
JavaRanch Sheriff


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Mijeong Yi
Greenhorn

Joined: Feb 12, 2006
Posts: 4
Ok. Thanks
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: c:forEachToken