.NET Zone | ASP Technology | PHP Technology | JSP Technology | Database
Search for
ASP foundation
Database related
Secure encryption
Full Text Search
ASP application
Print-related
Client-related
XML related
System
Regular expression
ASP skills
Component development
Script code
FSO topic
Mail related
Remote script
Performance optimization
74 Network Programming: ASP Technology: Client Related: About Page Local Refresh Routines About Page Local Refresh Routines
March 25,2004 [Batman] at 99-10-26 06:55:06 A concrete example of the CHINAASP JOY ASP RS technology In the previous post, I introduced the basic working principle of RS, obviously if RS Technical Application In a site design, there will be many extraordinary roles (especially the biggest advantage of it, you can call the server's code when you don't refresh the page). It is because of this feature, you can handle the data of the database like a traditional C / S mode program (I think everyone must know how the specific should be achieved, the following will give one Specific example, debugging this broke program almost gives me a tired, huh, huh, huh, huh, huh, huh.) It can be seen from the previous description. To use RS technology, the client and server need to meet the following two conditions: 1. The client only needs to support the Java Applet 2. The server only needs to support the ASP, that is, RS technology is completely independent and browser (of course, the browser needs to meet support Java and JavaScript), you can use it in IE, you can use it in NC This is also a significant feature of distinguishing between RDS technology. Before you can flexibly use RS technology, you will first explain a problem, which is the "asynchronous call" of "asynchronous call" that has been mentioned earlier. It is also because there is an asynchronous call to implement a part of you only refresh and do not refresh the entire page. Due to this feature, you can make the server to implement the legality check of the data in your browsing page (of course this can be a series of complex legitimacy checks, such as data and databases that need to be entered The existing data is compared, this is not the client's JS can be resolved) and then after the server returns the check result, you will make a corresponding action (eg, a dialog box tells the user to enter an error, etc.) The syntax is as follows: RSEXECUTE (ServerURL, FUNCTIONNAME, PARAM_LIST) The first parameter is the complete URL path of the ASP page you want to call. The second parameter is that the name you want to call the function is the input parameter required for this function. If The function you want to call requires two input parameters, that is, this way: RSEXECUTE (ServerURL, F_Arg_2) There are two ways to write when the call is performed, one is a call mode: objresult = RSExecute ( ServerURL, FUNCTIONNAME, F_ARG_2); another is another call mode without returning results: RSEXECUTE (URL, FUNC_NAME, F_ARG_1, F_ARG_2, CALLBACKFUNCTION); This calling method should be particularly concerned, where CallbackFunction is a client. JS function It represents the call on the server, and then call this function immediately and returns the result to this function.
A typical CallbackFunction function should be such a structure: function callbackfunction (objresult) {// Your own processing} The only input parameter Objresult is the return value of the RS call. Let's assume such a situation: users in the browser Enter the user's E-mail address, and then the user leaves the E-mail address input box to enter the next input process, this is the RS that is on the field, it queries this address in the server according to the address entered by the user, You can judge whether this user already exists, and then returns the result to the client, and uses DHTML technology in the client to prompt the user previously entered information in the input box called "ShowResult". function CallbackFunc (objResult) {// prompt the user information window [objResult.context] .value = objResult.return_value;} while RSExecute () calls should be so RSExecute (serverURL, functionname, f_arg_1, CallbackFunc, "ShowResult"); do not say , Don't say it, there is so much above, I think everyone can also see the head, and let the specific code to speak: (Please build a named NW on your server before using the code. The system DSN file, the file uses the example database of Northworld, the Chinese Access97 comes with the example database below, and the default.htm is divided into two, and the RS technology is used in the main.html page. You can notice it. No Submit is used in main.html, so if you don't appear in this page, you must use the "Get Information" to call with this partial page refresh technology through the mouse. After clicking the button, the page will have a small latency (this time, the Java Applet has established and the server connection in the background) and then immediately reply to the normal mouse, you can continue other in this page. Operation. You don't have to wait for the data when you refresh it like a normal page. Info.asp can understand at a glance, is actually a very simple procedure for processing strings. If you are familiar with DHTML technology, you can complete these operations at the client. As for Empdata.asp, the server processing data is processed. Ok, the benefits you can understand yourself.
Special attention, don't change too much code, otherwise it is easy to make mistakes, after all, is using JavaScript programming default.htm file code as follows: