NutzCN Logo
问答 Mvcs.getMessage取值,返回给页面中显式的内容是非中文格式,怎么破
发布于 3044天前 作者 明天会吹什么风 2220 次浏览 复制 上一个帖子 下一个帖子
标签: mvc

return Message.error("system.not.allow", req);
Object { type="error", content="\u64cd\u4f5c\u5931\u8d25"}

5 回复

return Message.error("system.not.allow", req);
content读取本地化中的中文
页面json获取到的对象是
Object { type="error", content="\u64cd\u4f5c\u5931\u8d25"}

你贴的代码里面哪有 Mvcs.getMessage 啊

@wendal 哦。我是用nutzfw-demo中的Message

public Message(Message.Type type, String content,Object data, HttpServletRequest req) {
this.type = type;
this.content = Mvcs.getMessage(req, content);
this.data=data;
}

入口方法加个

@Ok("json")

目测现在设置为 autoUnicode:true, 但这对json解析毫无影响,出来的依然会在正常编码的字符串

@Ok("json:{autoUnicode:true}")
添加回复
请先登陆
回到顶部