public ActionForward toExcel(ActionMapping mapping, ActionForm form, HttpServletRequest request,
HttpServletResponse response) throws Exception { String hiddenHtml = request.getParameter("hiddenHtml");
String fname = request.getParameter("hiddenName");
fname = java.net.URLEncoder.encode(fname, "UTF-8"); response.setCharacterEncoding("UTF-8");
response.setContentType("application/msexcel");
response.setHeader("Content-Disposition", "attachment;filename=" + fname); PrintWriter out = response.getWriter();
out.println(hiddenHtml); out.flush();
out.close(); return null;这个方法是把从数据库中查询出来的数据导入到excel表中,为什么全部导进去不乱码,而到部分数据进去,却乱码啊?纳闷啊~~