首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > 编程 >

调用REST服务乱码有关问题

2012-10-27 
调用REST服务乱码问题使用REST服务增加数据,中文出现乱码问题,可以选择将数据用问题传值法的方式以URL的字

调用REST服务乱码问题
使用REST服务增加数据,中文出现乱码问题,可以选择将数据用问题传值法的方式以URL的字符串作为Requst对象传递至后台!

public String  saveSystemNotice(@Context HttpServletRequest request) throws Exception{
String str = (String)request.getParameter("str");//request.getAttribute("name");
str= new String(str.getBytes("UTF-8"), "GBK");
String strs=java.net.URLDecoder.decode(str,"UTF-8");
try {
  this.mobileBusinessService.saveSystemNotice(strs);
  return "<xml><result>ok</result></xml>";
} catch (Exception e) {
return"<xml><result>no</result></xml>";
}

热点排行