list<PageData>傳jsp隱藏欄位,在傳回java

來源:互聯網
上載者:User

標籤:splay   lis   表單   提交   重點   time()   ram   dfa   username   

java傳jsp,代碼如下:

     /**去修改頁面     * @param     * @throws Exception     */    @RequestMapping(value="/goEdit")    public ModelAndView goEdit(Model model)throws Exception{        ModelAndView mv = this.getModelAndView();        PageData pd = new PageData();        pd = this.getPageData();        //擷取樹形列表        JSONArray arr = JSONArray.fromObject(goodstypeService.listAllGoodstypenourl("0"));    //此處填寫貨品類型第一級ID即可;        String json = arr.toString();        json = json.replaceAll("GOODSTYPE_ID", "id").replaceAll("GOODSTYPE_PARENTID", "pId").replaceAll("GOODSTYPE_NAME", "name").replaceAll("subDict", "nodes").replaceAll("hasDict", "checked").replaceAll("treeurl", "url");        model.addAttribute("zTreeNodes", json);        mv.addObject("GOODSTYPE_ID",0);        //0代表根目錄                pd = receivingstandardService.findById(pd);    //根據ID讀取        //根據收穫標準查詢所有的物料        List<PageData> wllist = receivingstandardmaterielService.findwlByRECEIVINGSTANDARD_ID(pd);        //根據收穫標準查詢所有的工廠        List<PageData> gclist = receivingstandardfactoryService.findgcByRECEIVINGSTANDARD_ID(pd);        mv.setViewName("cgxtpt/receivingstandard/receivingstandard_edit");        mv.addObject("msg", "edit");        mv.addObject("wllist", JSONArray.fromObject(wllist));           ----  重點是這裡        mv.addObject("gclist", JSONArray.fromObject(gclist));        mv.addObject("pd", pd);        return mv;    }

前台jsp接收:

<input type="hidden" name="wllist" id="wllist" value=‘${wllist }‘> <input type="hidden" name="gclist" id="gclist" value=‘${gclist }‘>

form表單提交給java處理

    /**修改     * @param     * @throws Exception     */    @RequestMapping(value="/edit")    public ModelAndView edit() throws Exception{        logBefore(logger, Jurisdiction.getUsername()+"修改Receivingstandard");        if(!Jurisdiction.buttonJurisdiction(menuUrl, "edit")){return null;} //校正許可權        ModelAndView mv = this.getModelAndView();        PageData pd = new PageData();        pd = this.getPageData();        receivingstandardService.edit(pd);        /**操作記錄*/        Session session = Jurisdiction.getSession();        User user = (User) session.getAttribute(Const.SESSION_USER);        PageData pd1 = new PageData();        pd1.put("RECEIVINGSTANDARDRECORD_ID", this.get32UUID());        pd1.put("RECEIVINGSTANDARD_ID", pd.getString("RECEIVINGSTANDARD_ID"));        pd1.put("UPDATERID", user.getUSER_ID());        pd1.put("UPDATENAME", user.getNAME());        pd1.put("UPDATETIME", DateUtil.getTime());        receivingstandardrecordService.save(pd1);        /**操作記錄結束*/        //根據收穫標準查詢所有的物料        List<PageData> wllist = receivingstandardmaterielService.findwlByRECEIVINGSTANDARD_ID(pd);        //根據收穫標準查詢所有的工廠        List<PageData> gclist = receivingstandardfactoryService.findgcByRECEIVINGSTANDARD_ID(pd);        //之前的物料        List<JSONObject> oldwllist = JSONArray.fromObject(pd.get("wllist")) ;      ----------重點是這裡        //之前的工廠        List<JSONObject> oldgclist = JSONArray.fromObject(pd.get("gclist")) ;        //之前的物料、工廠全部去掉        String msg2 = orderdataService.sendwmszjornojson(oldwllist, oldgclist,"N");        //現在的物料、工廠全部加上        String msg = orderdataService.sendwmszjorno(wllist, gclist,"Y");                System.out.println("物料。。。。。。。"+msg+msg2);        mv.addObject("msg","success");        mv.setViewName("save_result");        return mv;    }

兩種類型資料,一種是pagedata一種是JSONObject,後者擷取資料是:get();

  

list<PageData>傳jsp隱藏欄位,在傳回java

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.