• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Arrays in JSP

 
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Ranch Hand
Posts: 2908
1
Spring Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 2908
1
Spring Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic