This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Java in General and the fly likes Accessing HashMap from javascript Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Accessing HashMap from javascript" Watch "Accessing HashMap from javascript" New topic
Author

Accessing HashMap from javascript

Parameswaran Thangavel
Ranch Hand

Joined: Mar 01, 2005
Posts: 485
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

Joined: Apr 14, 2004
Posts: 10336


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.


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Accessing HashMap from javascript
 
Similar Threads
Security with swing
few suggestions
Modal Dilag box
disable the links in jsp page
Fine grained access control