File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
JavaRanch » Java Forums » Java » JSP
Reply locked New topic

How to pass value from Java to JavaScript

Ruta Kulkarni

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

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

Joined: Jan 10, 2002
Posts: 63866

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

Please SearchFirst.

[Asking smart questions] [About Bear] [Books by Bear]
I agree. Here's the link:
subject: How to pass value from Java to JavaScript
It's not a secret anymore!