• Post Reply Bookmark Topic Watch Topic
  • New Topic

Arrays in JSP

 
renu richard
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I found this code which is used for listing the values of an array in adrop down box.

Which is written under the script tag.
Instead of doing like this, i am trying to take the value from the property file and then setting them to the array. My code is as below,

while doing so, i am getting an error(invalid charachter constant) in these lines which i have marked as bold.
[ December 06, 2008: Message edited by: renu richard ]
 
Sagar Rohankar
Ranch Hand
Posts: 2907
1
Java Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Its 2-D array, and array index are integer literal OR constant (final) variable. So , I think, here country, cities and places are defined as




HTH
 
renu richard
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Please refer to this web page. There array values are given in the script itself. What i am trying to do is read it from the property file and assiging it as it is assigned in the javascript. Can you please tell me the array assignment which i am doing is correct or not. Thanks



[ December 06, 2008: Message edited by: renu richard ]
[ December 06, 2008: Message edited by: renu richard ]
 
Sagar Rohankar
Ranch Hand
Posts: 2907
1
Java Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My point is, you can not access array using single quoted string, like 'cities'..

If you look at the program, you can see that, author creating the 1D array in for loop and then putting respective country >> cities >> places information into adjacent block.

So this code helps,



HTH
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65522
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are mixing Java and JavaScript and they are completely different languages with different rules, even they have some similar syntax.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!