Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Java > Java and JDK > JSP Basics
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
JSP Basics Beginning-level questions on JSP. More advanced coders should post to Pro JSP.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the JSP Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old June 26th, 2005, 11:06 PM
Registered User
 
Join Date: Feb 2004
Location: , , .
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default How to assign javascript value to java?

hi,

we can assign java variable value to the javascript variable in HTML <head> tag the as follows:

<script language="JavaScript">
<!--
    var jsVar = '<%=javaVarVal%>'
//-->
</script>

Is there any way to assign javascript variable value to javavariable.
thanks,

Reply With Quote
  #2 (permalink)  
Old June 27th, 2005, 03:34 PM
Friend of Wrox
 
Join Date: Jul 2004
Location: , , .
Posts: 204
Thanks: 0
Thanked 0 Times in 0 Posts
Default

To pass a value to JSP you need to submit it to the page when opening it, if that makes sense. You cannot write directly to the variable, remember javascript runs on the client, java runs on the server. You must submit a request to the server to pass the values, by opening a page.

What you can do is to use javascript to open the page, so your javascript creates a link with relevant parameters to pass to the server when the next page is opened, though this is not something I do, it doesnt really seem worth the hassle.

I use javascript for rollovers etc. and to check form fields prior to submission, but pass the actual parameters from links/forms.

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how do you assign php to a row value in javascript RJ2001 Javascript How-To 0 August 13th, 2007 04:32 PM
How to assign xsl param with java script varaible Sanjay.Verma XSLT 1 November 21st, 2006 04:34 AM
assign javascript variable to asp variable manjunath_c_k Classic ASP Basics 1 September 14th, 2006 07:35 AM
How To Assign Value To Session Using Javascript janice.koay Classic ASP Professional 1 May 9th, 2006 12:59 AM
How to assign javascript to Java? salahu Pro JSP 1 August 8th, 2005 03:05 PM



All times are GMT -4. The time now is 10:48 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.