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

Question on HFSJ page 428, item 6

 
ozzie lorica
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
on the answers page it says that

e.) $list['listIdx'+1]} is invalid because 'listIdx'+ 1 becomes a String,

but when I tried on Tomcat(ver 5.5.27) the error I get was different, It seems that Tomcat was trying to coerce 'listIdx' into a long before the addition operation.


${list['listIdx'+1]}

An exception occured trying to convert String "listIdx" to type "java.lang.Long"

I was just wondering what the correct behavior should be? is it something wrong with HF or is there something wrong with tomcat?

I ask because in case I try to use them for maps with keys as 'listIdx1', 'listIdx2', I should be able to do something like 'listIdx'+1 or 'listIdx'+2, if I follow HF, then it is valid. but on tomcat, it wouldn't work. (yep, i've tried with a map too)

Thanks!
 
ozzie lorica
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
errrm. Stupid me, posted a question without doing a search, but i found the answer
String Concatenation in EL
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic