jQuery in Action, 2nd edition*
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
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: 60774
    
  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]
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: JS variable In JSP
 
Similar Threads
want to access an arraylist of jsp in javascript
Jsp & Javascript
Calling constants from another file in JS
JS variable to JAVA
Assigining java variable to java script variable