This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes JSP and the fly likes How to pass value from Java to JavaScript Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » JSP
Reply locked New topic
Author

How to pass value from Java to JavaScript

Ruta Kulkarni
Greenhorn

Joined: Dec 24, 2010
Posts: 1
I would like to know is it possible to pass value from Java to JavaScript.

I have called REST Web service which will return me the JSON Array response in Java, I want to pass this response to JavaScript. I can parse the response form JavaScript and can display it from HTML.

Please let me know if there is any possible way for it.

Thanks in advance.



Kishore Tulsiani
Greenhorn

Joined: Jan 15, 2010
Posts: 21
what I can say is from java you can store the value in request and from request you can take that value and store it in hidden element on HTML. once you got the value in hidden element it can be easily accessible in java script

sample code

Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60048
    
  65

Not directly. This question has been asked many times and has an entry n the JspFaq.

Please SearchFirst.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to pass value from Java to JavaScript
 
Similar Threads
Applet to Javascript communication
passing value from javascript function to JSP
Javascript variable inside jsp scriplet
Passing value to JSP from a method in Action class
assign var to java variable