Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

One peculiar thing about c:set

 
alzamabar
Ranch Hand
Posts: 379
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I wanted to share with you what I discovered while studying c:set.

I used c:set to set a variable with the following value:

"one, two, three".

Than, I used a c:forEach to print the variable out with the following code:



obtaining the following output:

one
two
three

So I thought: well, when assigning more than one value comma separated with c:set, the type must be String[]. Wrong. I ran a little test assigning the request attribute to an object and then printing the object.getClass() method and surprisingly I found that the variable is an instance of the String class and not an array of String. Strangely enough, though, the output splits the values comma separated as these were three strings, applying kind of an automatic tokenizer to comma separated values.

Weird, isn't it?
 
P. Dunn
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you try looking at varStatus? I wonder what that would be. I suppose 1 2 3
 
alzamabar
Ranch Hand
Posts: 379
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by P. Dunn:
Did you try looking at varStatus? I wonder what that would be. I suppose 1 2 3


You are right.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic