在JSP中,假设表单的method="post",在发送请求时中文乱码处理的正确做法是( )。
A: request.setCharacterEncoding("utf-8");
B: response.setCharacter("utf-8");
C: request.setContentType("text/html;charset=utf-8");
D: response.setContentType("text/html;charset=utf-8");
A: request.setCharacterEncoding("utf-8");
B: response.setCharacter("utf-8");
C: request.setContentType("text/html;charset=utf-8");
D: response.setContentType("text/html;charset=utf-8");
举一反三
- 在jsp中如果表单的提交方式是post,下列处理中文乱码正确的方式是( ) A: request.setCharacterEncoding(“utf-8”) B: request.setCharacter(“utf-8”) C: request.setContentType(“text/html;charset=utf-8”) D: response.setContentType(“text/html;charset=utf-8”)
- 用户使用POST方式提交的数据中存在汉字(使用utf-8字符集),在Servlet中需要使用下述______语句处理。 A: request.setCharacterEncoding("utf-8); B: request.setContentType("text/html;charset=utf-8"); C: response.setCharacterEncoding("utf-8"); D: response.setContentType("text/html;charset=utf-8");
- 在JSP中,假设表单的method="post",在发送请求时,对于中文乱码处理的正确做法是( ) A: request.setCharacterEncoding("utf-8"); B: response.setCharacter("utf-8"); C: request.setContentType("text/html;charset=utf-8"); D: response.setContentType("text/html;charset=utf-8");
- 若想正确解决参数中文乱码问题,下面操作正确的是? A: equest.setCharacterEncoding("utf-8"); B: esponse.setCharacterEncoding("utf-8"); C: esponse.setContentType("text/html;charset=utf-8"); D: equest.setContentType("text/html;charset=utf-8");
- 通过 response对象的setContentType()方法可以为响应设置内容类型 。比如"text/html;charset=utf-8"。