• 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
  • Devaka Cooray
  • Tim Cooke
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
Saloon Keepers:
  • Piet Souris
Bartenders:

Accessing HashMap from javascript

 
Ranch Hand
Posts: 485
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
reply
    Bookmark Topic Watch Topic
  • New Topic