473,397 Members | 2,099 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

how to interchange the variables between jsp, html and javascript?

1
1. If I have a var defined in javascript, can I use get its value outside javascript fragment? I means, not only to print out.

2. Or if I set a page/session scope variable defined by <c:set var="myVar" .../>. Could I change it's value within the javascript function and keep the changed value outside?

3. How can I get the value of a 'select' of a form before submit it by not using javascript?

How can give a advice? Thanks
Apr 27 '07 #1
1 4752
acoder
16,027 Expert Mod 8TB
1. If I have a var defined in javascript, can I use get its value outside javascript fragment? I means, not only to print out.
Yes, but it'd have to be within script tags or inline in a tag in an event handler, e.g. onclick.

2. Or if I set a page/session scope variable defined by <c:set var="myVar" .../>. Could I change it's value within the javascript function and keep the changed value outside?
You can generate JavaScript code using JSP, with a variable set to the session variable which could then be modified. However, this would have no effect on the server. To change server-side variables using JavaScript, you can use Ajax (JSP to change the variable values).

3. How can I get the value of a 'select' of a form before submit it by not using javascript?
Not possible without JavaScript.
Jun 7 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

12
by: zig | last post by:
I've posted this on alt.comp.lang.coldfusion, but is predominantly a javascript problem: I have a CF query which returns several rows of records. I wanted to have a checkbox on each record of...
3
by: mr_burns | last post by:
hi, i was wondering if anybody could tell me when a function is called and variables are defined within that function, are the variables global where i can call and modify the variables in other...
3
by: Chris | last post by:
Hi, I'm really begginer in javascript. I created a form in a pop-up opened with javascript. how to recover variables of the form in the main page. Thanks for your help Chris.
8
by: lawrence | last post by:
I'm learning Javascript. I downloaded a script for study. Please tell me how the variable "loop" can have scope in the first function when it is altered in the second function? It is not defined...
2
by: Les Peabody | last post by:
Hello. I'm a rookie ASP VBScripter and am having a difficult time scripting the following scenario: I have an index.asp file that has a multi-line text box and a button of type button. When...
1
by: stephane | last post by:
I have a problem which must be in this : print" <script type='text/javascript'> document.location.replace('http://127.0.0.1/add_task.php?req_id={$maxValue}&tk_request_name={$req_name}');...
8
by: mantrid | last post by:
Hello I have the following code, where clicking yh1r is supposed to move h1 10px down and update the value of yh1 by 20 each time its clicked. what the code actually does is NOT move h1 and...
26
by: BillE | last post by:
Some ASP.NET applications use Session Variables extensively to maintain state. These should be re-written to use viewstate, hidden fields, querystring, etc. instead. This is because if a user...
3
momotaro
by: momotaro | last post by:
am trying to impliment the Interchange trees is this function is correct? int Interchange(Tree *root, Tree **newroot){ Tree *temps; if (root){ temp =...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.