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 JS variable In JSP 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
Bookmark "JS variable In JSP " Watch "JS variable In JSP " New topic
Author

JS variable In JSP

Niklesh Mudiraj
Greenhorn

Joined: Jun 26, 2011
Posts: 10

Can we access variable/value of variable declare in JS in JSP page as we can use variable declare in JSP in JS .
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60050
    
  65

Niklesh Mudiraj wrote:Can we access variable/value of variable declare in JS in JSP page

No, of course not. JSP executes on the server, JavaScript on the client. They cannot mix and match.

Please read this article to find out how JSP works and why that could never be

as we can use variable declare in JSP in JS .

You cannot use JSP in JS either. See above.

You can use JSP to write JavaScript that is then sent to the browser, but you are not using the JSP variable in the JS.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JS variable In JSP
 
Similar Threads
JS variable to JAVA
Jsp & Javascript
Assigining java variable to java script variable
Calling constants from another file in JS
want to access an arraylist of jsp in javascript