In the process of using JSP,
Vibram FiveFingers Sprint, most people a headache is the question of Chinese garbage problem,
Vibram FiveFingers Speed, the following is encountered in software development and solutions to waste problems. 1, JSP pages garbled
this garbage should be no reason is specified in the page using the character set encoding,
Vibram Five Fingers, the solution: beginning place as long as the page with the following code to clarify the character set encoding.
2,
Women Vibram FiveFingers Sprint, the database garbled
this garbage makes you insert a database of Chinese garbled, or read the display is garbled, the solution is consist in ...:
addition the database articulation string in the character set encoding
String Url = setContentType (dissimilar page, the situation will be garbled, the solution is consist in ...:
parameters when the coding parameters, such for
RearshRes.jsp? keywords = br> and then receiving the parameter page using the following statement to receive
keywords = current String (request.getParameter (br> get garbled transportation parameters
============
2, login_do.jsp
out.println (temp);
%>
6, in the ajax in Chinese garbled pass url parameters to pay attention to the place:
instance, the following method:
/ / join type function
function addSort () {
var name = file.getElementById (. worth; / / get the txt box with id appoint value (in Chinese)
if (name ==; vigilant (; return disloyal;
}
var url = ; / / This is the Chinese name parameter
createXMLHttpRequest ();
XMLHttpReq.onreadystatechange = AddStateChange;
XMLHttpReq.open (/ / transmitted by post
XMLHttpReq.setRequestHeader ((url);
}
============
in the servlet to obtain parameter when:
/ / solve the url Chinese garbled opener parameter here,
Vibram FiveFingers New Styles, because post method to submit data in the default role encoding namely utf-8,
/ / if the backdrop is gb2312 or additional encoded data ambition be garbled, so there ought be a request parameter is set to utf-8
/ / Even although you jsp page is c
request.setCharacterEncoding (br> rejoinder.setContentType (,
Vibram Fivefinger, both show natural