Program debugging: Yang chengfu
This series of articles is written by ex_net (Zhang jianbo). Please indicate the source for reprinting.
Http://blog.csdn.net/ex_net/article/details/8139100
Author: Zhang jianbo mailbox: 281451020@qq.com Phone: 13577062679 welcome to exchange calls!
After the JCFXBL Server framework is installed, you can test it on the business test page.
The correct test results are as follows:
Serlet testing principles:
During the test, the client first requests the server through ajax. The key code is as follows:
[Javascript]
Function SerletTest (Serlet, tbLib, tbVer, tbState, return_value, tbResponse ){
Var xmlhttp;
If (window. XMLHttpRequest) {// code for IE7 +, Firefox, Chrome, Opera, Safari
Xmlhttp = new XMLHttpRequest ();
}
Else {// code for IE6, IE5
Xmlhttp = new ActiveXObject ("Microsoft. XMLHTTP ");
}
Xmlhttp. open ("GET", "/Execute. ashx? Serlet = "+ Serlet +" & act = Debug ", true );
Xmlhttp. onreadystatechange = function (){
If (xmlhttp. readyState = 4 & xmlhttp. status = 200 ){
PutSerletDebugMessage (xmlhttp. responseText, tbLib, tbVer, tbState, return_value, tbResponse );
}
}
Xmlhttp. send ();
}
After the test command is sent to the server for processing, the following code parses the returned data. The key code is as follows:
[Javascript]
Function PutSerletDebugMessage (responseText, tbLib, tbVer, tbState, return_value, tbResponse ){
Var str = responseText; // xmlhttp. responseText;
Str = str. replace ("[",'"');
Str = str. replace ("]", '"');
Var user2json = eval ("(" + str + ")"); // record the STRING to JASON
TbLib. value = user2json. return_msg;
TbVer. value = user2json. result;
TbState. value = user2json. success;
Return_value.value = user2json. return_value;
TbResponse. value = responseText; // xmlhttp. responseText;
}