标签:service utf-8 tac code exception odi ble auto 中文乱码
@Controller public class ItemController { @Autowired private ItemService itemService; @RequestMapping("/item/{itemId}") //@ResponseBody public void getItemById(@PathVariable Long itemId,HttpServletResponse response) throws IOException { TbItem tbItem; try { tbItem = itemService.getItemById(itemId);
//如果输出数据中文乱码
//response.setCharacterEncoding("UTF-8");
//response.setContentType("text/html;charset=UTF-8"); response.getWriter().print(tbItem); } catch (Exception e) { e.printStackTrace(); System.out.println("fdjksdjfsdjkfksjdkfjsjdk"); } } }
标签:service utf-8 tac code exception odi ble auto 中文乱码
原文地址:https://www.cnblogs.com/dianzan/p/11142258.html