日期:2014-05-19  浏览次数:20765 次

java转义符的问题
有没有高手解决下 问题
在strut 2的action内,声明了成员变量 

private String json;
public String getJson(){
    String str="PROID=28";
    json = str.replace("PROID=","\"id\":");
    System.out.println(str);
}
控制台输出 "id":28
直接访问action
则输出 \"id\":28
如果在网页上也是直接输出"id":28
怎么办
------解决方案--------------------
什么叫做“直接访问action”?

------解决方案--------------------
1、如果仅仅传递一个参数,没必要用json
2、如果传递多个参数,并且是异步的,采用json,但是页面要用eval函数处理