随笔 - 103  文章 - 0  评论 - 14  阅读 - 33万 
复制代码
/**
     * 根据id 查找活动对象
     * @throws IOException 
     * */
    public void getFishObj() throws IOException{
        String id = request.getParameter("id");
        Fishing fishing = (Fishing) fishService.getObjectById(id+"");
        
        JsonConfig jsonConfig = new JsonConfig();
        jsonConfig.registerJsonValueProcessor(Date.class, new JSONFormatDate("yyyy-MM-dd HH:mm:ss"));
        JSONObject jo = JSONObject.fromObject(fishing,jsonConfig);// 格式化result
        response.setContentType("text/html;charset=utf-8");
        PrintWriter out = response.getWriter();
        out.println(jo.toString());
        out.flush();
        out.close();
    }
复制代码
$.ajax({
   type: "POST", dataType: "JSON",
   url: "${pageContext.request.contextPath}/back/fish/getFishObj.action",
   data: {id:rows[0].fishId},
   success: function(data){
       $("#fishId").val(data.fishId);
       $("#fishName").val(data.fishName);
       $("#shopName").val(data.shopName);
       $("#factoryName").val(data.factoryName);
       $("#address").val(data.address);
   }
});
复制代码
复制代码
posted on   减肥的小老斧  阅读(159)  评论(0编辑  收藏  举报
点击右上角即可分享
微信分享提示