This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Accessing HashMap from javascript

 
Parameswaran Thangavel
Ranch Hand
Posts: 485
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all i am having the following requirement

there will be list of subjects displayed to the user. And the user is allowed to choose the subject he wants (from dropdown list). based on the subject he is choosen list of question pertain to that subject will be displayed.

Both the subject and questions are taken from back end.

I thought of loading the question and its corresponding question in hasMap and access it from java script, to display it to the user. But i have no idea how to access it or is it possible to access it.

If there is any better way you to access the data in javascript, please share with me.

Thanks
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I thought of loading the question and its corresponding question in hasMap and access it from java script, to display it to the user. But i have no idea how to access it or is it possible to access it.

This is not possible. JavaScript can't instantiate Java code, they are two unrelated technologies. If your Java is running client side it is doing so in an Applet, in which case you don't need JavaScript, since Swing gives you the same select box functionality. If it is running server side (i.e. in a Servlet) it is relatively simple to write out the contents of your HashMap to a HTML select form element, or into a JavaScript array.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic