rest之ftl后台中文到前台乱码解决

……

 if (queue != null && queue.getSubscriberIds() != null && !queue.getSubscriberIds().isEmpty()) {
            return "删除队列之前必须先删除队列的订阅者,队列下面还有以下订阅者" + queue.getSubscriberIds();
 }

这句中文到页面提示乱码????????

……

else{
     //删除订阅者之前必须先删除队列的订阅者,以下队列还有该订阅者
      $.messager.alert('提示', msg, 'warning');
      return false;
}

解决:

只需在controller的类里面加上一句话:

 produces = "text/plain;charset=UTF-8"

 

@ResponseBody
    @RequestMapping(value = "/delete", method = RequestMethod.POST, produces = "text/plain;charset=UTF-8")
    public String deleteSubscriber(String subscriberId) throws Exception {
这个样子就可以解决乱码问题
posted @ 2014-01-15 16:13  静子1019  Views(357)  Comments(0Edit  收藏  举报