index.jsp中构造param:
function hello() {
alert("hello");
var mydata = [{"word" : "12345"}];
alert(JSON.stringify(mydata));
$.post('hello', JSON.stringify(mydata), function(text, status) {
alert(text);
});
}
请求接收端的代码如下:
@Controller
public class HelloWorldController
{
@RequestMapping(value = "/hello",method = RequestMethod.POST)
public @ResponseBody HttpSayHelloTestRsp sayHello(
@RequestBody String req) throws UnsupportedEncodingException
{
String decodeStr = URLDecoder.decode(req,"utf-8");
System.out.println("-----------------收到Hello请求\r\n"+decodeStr );
return null;
}
}
但是在HelloWorldController端接收到的decodeStr是[{"word" : "12345"}]=
而且,在firfox浏览器的控制台界面,看到传输的参数是:[{"word" : "12345"}]:
请问各位大神,这是什么情况?