java常用检验接口control方式

2020-12-13 05:29

阅读:337

标签: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"); } } }

 

java常用检验接口control方式

标签:service   utf-8   tac   code   exception   odi   ble   auto   中文乱码   

原文地址:https://www.cnblogs.com/dianzan/p/11142258.html


评论


亲,登录后才可以留言!