• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

c:forEachToken

 
Mijeong Yi
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Mijeong Yi
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64718
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"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
 
Mijeong Yi
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok. Thanks
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic