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 How to assign js variable to jsp variable 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 "How to assign js variable to jsp variable" Watch "How to assign js variable to jsp variable" New topic
Author

How to assign js variable to jsp variable

shyam sunder prasad
Ranch Hand

Joined: Mar 23, 2011
Posts: 62


how to assign java script variable to jsp scriplet variable.

like jspName=name;

please help,thanks in advance.
Shanky Sohar
Ranch Hand

Joined: Mar 17, 2010
Posts: 1051

This can be done effectively with the help of form submission..

Submit the form and then request goes to servlet and in servet set the request parameter,or session parameter as per your requirement

Get those parameter in your jsp scriplet


SCJP6.0,My blog Ranchers from Delhi
shyam sunder prasad
Ranch Hand

Joined: Mar 23, 2011
Posts: 62
no i want fetch the data there it self
Shanky Sohar
Ranch Hand

Joined: Mar 17, 2010
Posts: 1051

Its not possible.as the scope of javascript is within the page only where you are using it
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60053
    
  65

You have a fundamental misunderstanding of what JSP is and how it works. Please read this article to see why what you are asking is completely impossible.


[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 assign js variable to jsp variable
 
Similar Threads
Head First Servlets & JSP book - JSP Question
use javascript variable in JSP?
server side and client side variables
JS ---> JSP variables
how to call Jsp in servlet