How to javascript in the value back to the jsp of variables (not only in the pages of the category)
Abstract: How to javascript in the value back to the jsp of variables (not only in the pages of the category)
<script Language="javaScript">
Var subtractItem = document.getElementById ( "substractItem");
Var score;
Var dep = document.getElementById ( "depname");
Function subtract ()
(
Window.parent.document.all.item ( "Main1_task_id"). Value;
)
</ Script>
I want to "window.parent.document.all.item (" Main1_task_id "). Value" directly to the value of a variable in the jsp
Impossible to achieve.
Agree upstairs
Thank you
AJAX Technology
Impossible to achieve, AJAX at the same time the request is submitted, but through asynchronous request! Users see!
Impossible, not to ajax
Oh, impossible. Or submit it honestly.
A need to
Forever. . . . . . . . . Impossible
AJAX can say
How AJAX done? Out of Kanya?
Var http_request = false;
Var methodName = null;
Function send_request (url) (/ / initialization, the designated processing function, a function of the request sent
Http_request = false;
/ / Initialization started XMLHttpRequest object
If (window.XMLHttpRequest) (/ / Mozilla browser
Http_request = new XMLHttpRequest ();
If (http_request.overrideMimeType) (/ / Set MiME category
Http_request.overrideMimeType ( 'text / xml');
)
)
Else if (window.ActiveXObject) (/ / IE browser
Try (
Http_request = new ActiveXObject ( "Msxml2.XMLHTTP");
) Catch (e) (
Try (
Http_request = new ActiveXObject ( "Microsoft.XMLHTTP");
) Catch (e) ()
)
)
If (! Http_request) (/ / anomaly, the failure to create instances
Window.alert ( "can not create XMLHttpRequest object instance.");
Return false;
)
Http_request.onreadystatechange = processRequest;
/ / Determine the modalities and sent the request URL and the simultaneous implementation of the code
Http_request.open ( "POST", url, true);
Http_request.send (null);
)
/ / Return information processing function
Function processRequest () (
If (http_request.readyState == 4) (/ / Object state judge
If (http_request.status == 200) (/ / information has been successfully returned to start processing information
Var returnValue = Trim (unescape (http_request.responseText));
If (methodName! = Null) (
Eval (methodName +"('"+ returnValue +"')");
)
) Else (/ / pages is not normal
Alert ( "You have an unusual request pages.");
)
)
)
/ / Precursor to follow-up spaces
Function Trim (str)
(
If (str =="") return str;
Var newStr = "" + str;
RegularExp = / ^ / s + | / s + $ / gi;
Return newStr.replace (RegularExp, "");
)
//************************************************ *********************************
/ / Url xmlhttp to be submitted to the addresses of the pages methodName callback function
Function xmlHttpSubmit (url, methodName) (
This.methodName = methodName;
Send_request (url);
)
However, attention to this does not automatically submit to the control input in a form of what you need to form inside the parameters? & Url joined the way
The value of the responseText you use response.getWriter (). Print ("….") value
Client and server-side interaction must be submitted through, whether it is submitted or AJAX pages submitted.
Not to impossible, JSP code before JS implementation.
Javascript applet and can be used to exchange will be able to achieve You
Should do it
I take a look at the description of miscellaneous Lane.
Structs structure
Displayed on a page, a table of information,
1 modification and deletion
2 modification and deletion
3 modification and deletion
I point this page revision in the above showed that the value of each option disappeared after amending the preservation of miscellaneous achieved?
Note: In fact, there were Add button above, add this Haolong point, the point that amending miscellaneous Lane ah? ? ? ? ?
JS of client code is JSP Server-side code, which is not impossible-communication value.
I said that the hybrid can achieve? Talk about that? ? ? ?
Learning to
The landlord to you in the other art here, Hey, can not think there are people with such problems ..
Mark
Mark
Joke, how might not be able to, since the document can be js assign variables java class files, so why not pass the variable jsp?
It is impossible not to the server
JS your operation is, we should pass JSP variables doing?
On the Web are not familiar with the programming model started on the project, you are transferred from the eight Asp.net
↑ Back
Tags: java environment variables
Releated Java Articles
April 11, 2007 | Filed Under Getting Started |






