struts1获取表单中文数据乱码
publicActionForwardexecute(ActionMappingmapping,ActionFormform,HttpServletRequestrequ...
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
request.setCharacterEncoding("UTF-8");
response.setContentType("text/html;charset=UTF-8");
response.setCharacterEncoding("UTF-8");
conn = getConnection();
RegistForm registForm = (RegistForm) form;
String password = registForm.getPassword();
String retypePassword = registForm.getRetypePassword();
String username0 = registForm.getUserName();
System.out.println(username0); 展开
HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
request.setCharacterEncoding("UTF-8");
response.setContentType("text/html;charset=UTF-8");
response.setCharacterEncoding("UTF-8");
conn = getConnection();
RegistForm registForm = (RegistForm) form;
String password = registForm.getPassword();
String retypePassword = registForm.getRetypePassword();
String username0 = registForm.getUserName();
System.out.println(username0); 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询