File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes HTML, CSS and JavaScript and the fly likes How to pass a value from a JSP to Javascript on the same page. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "How to pass a value from a JSP to Javascript on the same page." Watch "How to pass a value from a JSP to Javascript on the same page." New topic
Author

How to pass a value from a JSP to Javascript on the same page.

Ramesh Shanmugam
Ranch Hand

Joined: Sep 13, 2004
Posts: 132
How to pass a value from a JSP to Javascript on the same page.


Ramesh Shanmugam - SCJP 1.5
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
On the server side, you need to write out the JavaScript that holds that information. Only way for JavaScript to get the info.

Eric
Ramaswamy Srinivasan
Ranch Hand

Joined: Aug 31, 2004
Posts: 295
Hi Eric,

A clarification needed here.....

Can't it be done in the client side itself? Do we really need to do it the .js at the server side?

Is there no way like var



Might sound silly, but to know that...

Cheers,
Swamy.
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
Only way for the JSP to pass the value to the page is to dynamically write it to the page. It can be placed in a text field or written to a varaible, or place it in a cookie. There is really no other way to do it then those ways.

Eric
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60822
    
  65

See this topic.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
 
subject: How to pass a value from a JSP to Javascript on the same page.
 
Similar Threads
How do you set a javascript variable from jsp?
global variables in Javascript
How to fetch value from Text box of JSP page
Hidden fields in Javascript
RunTime passing value Jsp