• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JSP variable typical problem

 
Ramesh Sunkara
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!!!



 
David Newton
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic