当前位置: 代码迷 >> JavaScript >> json窗体
  详细解决方案

json窗体

热度:253   发布时间:2012-08-24 10:00:21.0
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
  相关解决方案