This feature has been in the trial for a week, there is no problem, strange that there is a problem today??
Copy Code code as follows:
Ajaxrequestobj.createeqstatusparameter=function () {
if (Eqstatusarray.length < 1) {
Return
}
var paramnamearray = new Array ();
var paramvaluearray = new Array ();
Take an array of states
for (var index = 0, step = eqstatusarray.length Index < step; index++) {
var tempeqstatusobj = Eqstatusarray[index];
Paramnamearray.push (Tempeqstatusobj.eqcode + "'" + tempeqstatusobj.opdatetime);
Paramvaluearray.push (Tempeqstatusobj.status);
}
Decompose and generate a request string.
var paramstr = "";
Paramstr = Paramstr.concat ("eqstatusnames="). Concat (encodeURIComponent (",")). Paramnamearray.join ("&" );
Paramstr = Paramstr.concat ("eqstatusvalues="). Concat (encodeURIComponent ("'"));
return paramstr;
};
Xmlhttpobj.setrequestheader ("Content-type", "application/x-www-form-urlencoded")
Xmlhttpobj.send (param);
The client passes the parameters in UTF-8 to the application, which can be taken directly from the request when this parameter is used.
[Ajax receive response information]
Directly using forward jump to implement div local content change
Copy Code code as follows:
if ("Doqueryrequest". Equals (Actparam)) {
Equiputils equiputilsobj = Equiputils.getinstance ();
Take query parameters, stitching
Equipstatusmgrobj.setequipcondition (Equiputilsobj.createequipfilter (request));
Equipstatusmgrobj.setequipstatuscondition (equiputilsobj.getequipstatusdate (request));
Device information
list<dynabean> Equiparray = Equipstatusmgrobj.queryequip (null);
Device status
Map<string, map<string, string>> equipstatusmapping =
Equipstatusmgrobj.queryequipstate4map (Equiparray, NULL);
Sessionobj.setattribute ("Paginationentity", equipstatusmgrobj.getpaginationentity ());
Sessionobj.setattribute ("Equipcondition", Equipstatusmgrobj.getequipcondition ());
Sessionobj.setattribute ("Eqstatuscondition", Equipstatusmgrobj.getequipstatuscondition ());
Request.setattribute ("Equiplist", Equiparray);
Request.setattribute ("Datelist", equipstatusmapping);
try {
Request.getrequestdispatcher ("/eq/detectpoint/innereqstatusrefresh.jsp"). Forward (request, response);
catch (Exception e) {
E.printstacktrace ();
}
else if ("Getpagetoolbar". Equals (Actparam)) {
Paginationentity pentity = (paginationentity) sessionobj.getattribute ("paginationentity");
String TempStr = Pentity.getpaginationtool ();
OutputStream out;
try {
Response.setcontenttype ("Text/html;charset=utf-8");
out = Response.getoutputstream ();
Out.write (Tempstr.getbytes ("UTF-8"));
Out.flush ();
Out.close ();
catch (IOException e) {
E.printstacktrace ();
}
}
Because, the current use xmlhttpobj.responsetext,responsetext default is UTF-8 so will jump the page to make UTF-8 is a good choice. At least don't worry about garbled.
[garbled reason]
Previously this feature used GB18030 encoding, to modify the other clients and colleagues on the machine is very normal, but my own machine page appears garbled. When I use the rendering file for this feature to unify the UTF-8 OK, also do not know that Xmlhttpobj touched the machine of that nerve. Some of the data are also said to engage in internationalization trends, the problem is solved but did not find the reason!
[Discover a bug]
Response.setcontenttype ("Text/html;charset=utf8"); I don't throw it wrong on my machine, but I throw it wrong on my colleague's machine.
Change to Response.setcontenttype ("Text/html;charset=utf-8"); all OK.