magic_agate 发表于 2013-2-6 09:30:21

json窗体 .

var url=urlPath+"/vehicle/insurance/xzsbssx.jsp?readonly=" + $pick(readonly, "true");
var retValue=window.showModalDialog(url,window,"dialogWidth:45;dialogHeight:15;center:yes;status:'no'");







后台

JsonObject jsonObject=new JsonObject();
jsonObject.add("returnVlue", policyForViewBean.toJsonElement());
GsonBuilder builder=new GsonBuilder();
String returnVlue=builder.create().toJson(jsonObject);
//request.setAttribute("returnVlue", returnVlue);
PrintWriter out = null;
try {
   out = response.getWriter();
   out.print(returnVlue);
   log.debug(returnVlue);
} catch (Exception e) {
   log.error("获取Writer错误!", e);
   throw new CommonException(ErrorConstants.SERVICE_ERROR, ErrorConstants.S_INTEGRATION_ERROR, "系统错误!");
} finally {
   if (out != null) {
    out.flush();
    out.close();
   }
}



var returnVlue= eval('(' +returnVlue + ')').returnVlue;



结果为returnVlue
页: [1]
查看完整版本: json窗体 .