• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

JSP variable typical problem  RSS feed

 
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi..

I have to get some values from a notepad file and show them in drop down list in my page.

First ,I retrieved the node values and stored them in an ArrayList .

I want to access these values in my JAVASCRIPT. I cant do that. Only the first value in the Arraylist is being populated many times.

I even declared "j' as static.

Please Help me!!!



 
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's almost illegible.

In any case, you seem to have some confusion about how JSPs work: *all* of the Java scriptlets are executed *before* the HTML is returned to the client. *Then* the JavaScript is executed.

With that in mind, you should now understand why what you're doing will never work. There are several other major issues, but let's focus on understanding the basics first. For folks that found the original impossible to read, here it is formatted:The bottom line is that the file should be read in a servlet, the lines exposed in a scoped attribute, and rendered using JSP and JSTL. But before getting further help, let's make sure we're on the same page regarding the difference between Java and JavaScript and when they're executed.
 
Ramesh Sunkara
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks DAVID

By surfing net i got the solution. It cleared my problem.

Is this the right of doing?




I pasted lines which i modified
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't understand why you're using JavaScript at all.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!