aspose 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


Win a copy of Spring in Action this week in the Spring forum!
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: 61417
    
  67

See this topic.


[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 a value from a JSP to Javascript on the same page.