Example usage for org.springframework.web.bind.support SessionStatus setComplete

List of usage examples for org.springframework.web.bind.support SessionStatus setComplete

Introduction

In this page you can find the example usage for org.springframework.web.bind.support SessionStatus setComplete.

Prototype

void setComplete();

Source Link

Document

Mark the current handler's session processing as complete, allowing for cleanup of session attributes.

Usage

From source file:egovframework.example.sample.web.EgovSampleController.java

@RequestMapping(value = "/accountUpdateX.do", method = RequestMethod.POST)
public void accountUpdateX(HttpServletRequest request, HttpServletResponse response, SessionStatus status)
        throws Exception {
    PlatformData oData = new PlatformData();
    int nErrorCode = 0;
    String strErrorMsg = "START";

    HttpPlatformRequest pReq = new HttpPlatformRequest(request);
    pReq.receiveData();//????  ??  

    PlatformData iData = pReq.getData();
    VariableList in_vl = iData.getVariableList();
    int cash = in_vl.getInt("sVal1"); // ?

    DataSet ds = iData.getDataSet("Account");

    try {//ww w . j a va2  s.  com
        String id = request.getParameter("id");
        System.out.println(" ?-" + id + " ?" + cash);
        Account account = new Account();
        account.setA_cash(cash);
        account.setA_id(id);
        sampleService.useCash(account);
        status.setComplete();
    } catch (Exception e) {
        nErrorCode = -1;
        strErrorMsg = e.getMessage();
        e.printStackTrace();
    }

    // VariableList 
    VariableList varList = oData.getVariableList();

    // VariableList? ? ? 
    varList.add("ErrorCode", nErrorCode);
    varList.add("ErrorMsg", strErrorMsg);

    // HttpServletResponse ? HttpPlatformResponse ?
    HttpPlatformResponse pRes = new HttpPlatformResponse(response, PlatformType.CONTENT_TYPE_XML, "UTF-8");
    pRes.setData(oData);

    // ?? 
    pRes.sendData();
}

From source file:egovframework.example.sample.web.EgovSampleController.java

@RequestMapping(value = "/deleteAccountX.do", method = RequestMethod.POST)
public void deleteAccountX(HttpServletRequest request, HttpServletResponse response, SessionStatus status)
        throws Exception {
    System.out.println("-----------------------------------------");
    //PlatformData oData = new PlatformData();
    int nErrorCode = 0;
    String strErrorMsg = "START";

    HttpPlatformRequest pReq = new HttpPlatformRequest(request);
    pReq.receiveData();//????  ??  

    PlatformData iData = pReq.getData();

    VariableList in_vl = iData.getVariableList();
    String in_var2 = in_vl.getString("sVal1");
    System.out.println("? ?--" + in_var2);
    int count = 1;
    System.out.println(count);//from w ww  .j  a v a 2s. c  o  m

    //   if (count==1) { //?3? ??
    try {

        Account accVO = new Account();
        accVO.setA_id(in_var2);

        sampleService.deleteAccount(accVO);
        status.setComplete();
        System.out.println("?");
        //         count +=2;
        //         
        //System.out.println(count);
        nErrorCode = 0;
        strErrorMsg = "SUCC";
    } catch (Exception e) {
        // VariableList? ? ? 
        nErrorCode = -1;
        strErrorMsg = e.getMessage();
        e.printStackTrace();
    }
    //   }

    nErrorCode = 0;
    strErrorMsg = "SUCC";
    PlatformData oData = new PlatformData();
    VariableList varList = oData.getVariableList();

    varList.add("ErrorCode", nErrorCode);
    varList.add("ErrorMsg", strErrorMsg);

    HttpPlatformResponse pRes = new HttpPlatformResponse(response, PlatformType.CONTENT_TYPE_XML, "UTF-8");
    pRes.setData(oData);
    //send data
    pRes.sendData();
    System.out.println("------------------------------------------");

}

From source file:egovframework.example.sample.web.EgovSampleController.java

@RequestMapping(value = "/updateKart.do", method = RequestMethod.POST)
public String updateKart( //? ?  
        HttpServletRequest request, Model model, SessionStatus status) throws Exception {
    int ind = Integer.parseInt(request.getParameter("index"));

    int thisSeq = Integer.parseInt(request.getParameter(ind + "tseq"));
    int eaInput = Integer.parseInt(request.getParameter(ind + "eaInput"));

    //   System.out.println("thisSeq-"+thisSeq);
    //   System.out.println("eaInput-"+eaInput);

    KartVO vo = new KartVO();
    vo.setK_tseq(thisSeq);/*from  w  w  w. j a v  a  2 s  .  c  o m*/
    KartVO kvo2 = sampleService.getPseq(vo);
    int p_seq = kvo2.getK_seq();
    Product product = new Product();
    product.setP_seq(p_seq);

    Product pro = sampleService.selectProduct(product);
    int price = pro.getP_price();
    int priceSum = price *= eaInput;
    int cashSum2 = priceSum / 20;
    cashSum2 = (int) (Math.floor(cashSum2 / 10) * 10);

    vo.setK_ea(eaInput);
    vo.setK_price(priceSum);
    vo.setK_cash(cashSum2);

    sampleService.updateKart(vo);
    status.setComplete();
    ///////////////
    HttpSession hs = request.getSession();
    Account loginInfo = (Account) hs.getAttribute("userInfo");
    KartVO kart = new KartVO();
    kart.setK_id(loginInfo.getA_id());

    List<KartVO> kartList = sampleService.kartList(kart);

    int sum = 0;
    int cashSum = 0;
    String deliveryPay = "no";
    for (int i = 0; i < kartList.size(); i++) {
        KartVO kvo = kartList.get(i);
        //   System.out.println(kvo.getK_price());
        sum += kvo.getK_price();
        cashSum += kvo.getK_cash();
        if (kvo.getK_deliveryprice() == 4000) {
            deliveryPay = "yes";
        }
    }
    model.addAttribute("deliveryPay", deliveryPay);
    model.addAttribute("sum", sum);
    model.addAttribute("cashSum", cashSum);

    model.addAttribute("resultList", kartList);
    model.addAttribute("login", "loginOK.jsp");
    model.addAttribute("main", "kartPage.jsp");

    return "sample/home";

}

From source file:egovframework.example.sample.web.EgovSampleController.java

@RequestMapping(value = "/boardReplyX.do", method = RequestMethod.POST)
public void boardReplyX(HttpServletRequest request, HttpServletResponse response, SessionStatus status)
        throws Exception {

    System.out.println("======== ============");
    PlatformData oData = new PlatformData();
    int nErrorCode = 0;
    String strErrorMsg = "START";

    HttpPlatformRequest pReq = new HttpPlatformRequest(request);
    pReq.receiveData();//????  ??  

    PlatformData iData = pReq.getData();

    VariableList in_vl = iData.getVariableList();
    int in_var2 = in_vl.getInt("sVal1");
    //   System.out.println("seq ???????>>>>>>>>>>>----"+in_var2);
    DataSet ds = iData.getDataSet("board2");

    //String bUuid = UUID.randomUUID().toString();

    String bUuid = request.getParameter("uuid");
    SampleVO samVO = new SampleVO();
    samVO.setbSeq(in_var2);

    SampleVO sam2 = new SampleVO();
    sam2 = sampleService.selectSample(samVO);
    sampleService.getReply(sam2);/*from  w  w  w .  j a  va  2s  . co  m*/
    status.setComplete();
    try {
        SampleVO svo = new SampleVO();

        svo.setbName(ds.getString(0, "B_NAME"));
        svo.setbTitle(ds.getString(0, "B_TITLE"));
        svo.setbPass(ds.getString(0, "B_PASS"));
        svo.setbContent(ds.getString(0, "B_CONTENT"));
        svo.setbNum(sam2.getbNum());
        svo.setbUuid(bUuid);
        svo.setbReSeq(sam2.getbReSeq());

        svo.setbUuid(bUuid);
        //System.out.println("name"+samVO.getName());
        sampleService.insertReply(svo);
        status.setComplete();

    } catch (Exception e) {
        // VariableList? ? ? 
        nErrorCode = -1;
        strErrorMsg = e.getMessage();
        e.printStackTrace();
    }

    // VariableList 
    VariableList varList = oData.getVariableList();

    // VariableList? ? ? 
    varList.add("ErrorCode", nErrorCode);
    varList.add("ErrorMsg", strErrorMsg);
    varList.add("out_var", "1234"); // 

    //   return "forward:/egovSampleList.do";

    // HttpServletResponse ? HttpPlatformResponse ?
    HttpPlatformResponse pRes = new HttpPlatformResponse(response, PlatformType.CONTENT_TYPE_XML, "UTF-8");
    pRes.setData(oData);

    // ?? 
    pRes.sendData();

    System.out.println("======== ??============");
}

From source file:egovframework.example.sample.web.EgovSampleController.java

@RequestMapping(value = "/boardIDU.do", method = RequestMethod.POST)
public void boardIDU(HttpServletRequest request, HttpServletResponse response,
        @RequestParam("uuid") String uuid, SessionStatus status) throws Exception {
    //   System.out.println("? uuid--"+request.getParameter("uuid"));
    PlatformData oData = new PlatformData();
    int nErrorCode = 0;
    String strErrorMsg = "START";

    HttpPlatformRequest pReq = new HttpPlatformRequest(request);
    pReq.receiveData();//????  ??  

    PlatformData iData = pReq.getData();
    DataSet ds = iData.getDataSet("board2");

    //String bUuid = UUID.randomUUID().toString();
    //String bUuid = request.getParameter("uuid");

    try {/*from   w w w .  j a  v a2  s.  c o m*/
        SampleVO svo = new SampleVO();
        svo.setbName(ds.getString(0, "B_NAME"));
        svo.setbTitle(ds.getString(0, "B_TITLE"));
        svo.setbPass(ds.getString(0, "B_PASS"));
        svo.setbContent(ds.getString(0, "B_CONTENT"));
        svo.setbUuid(uuid);
        //System.out.println("name"+samVO.getName());
        sampleService.insertSample(svo);
        status.setComplete();

        //   List<SampleVO> ListSamVO= new l

    } catch (Exception e) {
        // VariableList? ? ? 
        nErrorCode = -1;
        strErrorMsg = e.getMessage();
        e.printStackTrace();
    }

    // VariableList 
    VariableList varList = oData.getVariableList();

    // VariableList? ? ? 
    varList.add("ErrorCode", nErrorCode);
    varList.add("ErrorMsg", strErrorMsg);
    varList.add("out_var", "1234"); // 

    //   return "forward:/egovSampleList.do";

    // HttpServletResponse ? HttpPlatformResponse ?
    HttpPlatformResponse pRes = new HttpPlatformResponse(response, PlatformType.CONTENT_TYPE_XML, "UTF-8");
    pRes.setData(oData);

    // ?? 
    pRes.sendData();
}

From source file:egovframework.example.sample.web.EgovSampleController.java

@RequestMapping(value = "/QnaReplyX.do", method = RequestMethod.POST)
public void qnaReplyX(HttpServletRequest request, HttpServletResponse response, SessionStatus status)
        throws Exception {

    System.out.println("========qna ============");
    PlatformData oData = new PlatformData();
    int nErrorCode = 0;
    String strErrorMsg = "START";

    HttpPlatformRequest pReq = new HttpPlatformRequest(request);
    pReq.receiveData();//????  ??  

    PlatformData iData = pReq.getData();

    VariableList in_vl = iData.getVariableList();
    int in_var2 = in_vl.getInt("sVal1");
    //   System.out.println("seq ???????>>>>>>>>>>>----"+in_var2);
    DataSet ds = iData.getDataSet("qna");

    //String bUuid = UUID.randomUUID().toString();

    String bUuid = request.getParameter("uuid");
    QnaVO qnaVO = new QnaVO();
    qnaVO.setQ_seq(in_var2);

    QnaVO qnaVO2 = new QnaVO();
    qnaVO2 = sampleService.selectQna(qnaVO);

    sampleService.getReplyQnA(qnaVO2);//re seq 1?, >
    status.setComplete();
    System.out.println("? seq" + Integer.parseInt(request.getParameter("pseq")));
    try {/*from w  w w .jav  a 2  s . co m*/
        QnaVO qnavoo = new QnaVO();
        //SampleVO svo = new SampleVO();

        String title = "" + ds.getString(0, "Q_TITLE");
        System.out.println("-------" + title);
        qnavoo.setQ_name(ds.getString(0, "Q_NAME"));
        qnavoo.setQ_title(title);
        qnavoo.setQ_pass(ds.getString(0, "Q_PASS"));
        qnavoo.setQ_content(ds.getString(0, "Q_CONTENT"));
        qnavoo.setQ_num(qnaVO2.getQ_num());
        qnavoo.setQ_uuid(bUuid);
        qnavoo.setQ_re_seq(qnaVO2.getQ_re_seq());
        qnavoo.setQ_pseq(Integer.parseInt(request.getParameter("pseq")));
        //System.out.println("name"+samVO.getName());
        sampleService.insertQnaReply(qnavoo);
        status.setComplete();

    } catch (Exception e) {
        // VariableList? ? ? 
        nErrorCode = -1;
        strErrorMsg = e.getMessage();
        e.printStackTrace();
    }

    // VariableList 
    VariableList varList = oData.getVariableList();

    // VariableList? ? ? 
    varList.add("ErrorCode", nErrorCode);
    varList.add("ErrorMsg", strErrorMsg);
    varList.add("out_var", "1234"); // 

    //   return "forward:/egovSampleList.do";

    // HttpServletResponse ? HttpPlatformResponse ?
    HttpPlatformResponse pRes = new HttpPlatformResponse(response, PlatformType.CONTENT_TYPE_XML, "UTF-8");
    pRes.setData(oData);

    // ?? 
    pRes.sendData();

    System.out.println("======== ??============");
}

From source file:egovframework.example.sample.web.EgovSampleController.java

@RequestMapping(value = "/qnaInsert.do", method = RequestMethod.POST)
public String qnaInsert(HttpServletRequest request, Model model,

        @RequestPart(required = false, value = "file") List<MultipartFile> imgFile,
        @ModelAttribute("searchVO") SampleDefaultVO searchVO, @RequestParam("qName") String qName,
        @RequestParam("qPass") String qPass, @RequestParam("qTitle") String qTitle,
        @RequestParam("qContent") String qContent, @RequestParam("qUuid") String qUuid,
        @RequestParam("selectedId") int selectedId, //? seq
        @RequestParam("type") String type,

        SessionStatus status

) throws Exception {
    if (!imgFile.isEmpty()) {
        String dir = request.getRealPath("images/egovframework/board_img");
        System.out.println("dd" + imgFile.size());
        for (int i = 0; i < imgFile.size() - 1; i++) {
            //?//from  w  ww  . j  a  v a  2s.  co m
            String genId = UUID.randomUUID().toString();

            //?
            String originalFileName = imgFile.get(i).getOriginalFilename();
            //?
            //   String saveFileName = genId+"."+originalFileName;
            String saveFileName = genId;

            String savePath = dir + "/" + saveFileName;
            imgFile.get(i).transferTo(new File(savePath));
            SampleVO vo = new SampleVO();
            vo.setiOriName(originalFileName);
            vo.setiFileName(saveFileName);
            vo.setiSize((int) imgFile.get(i).getSize());
            vo.setiUrl(savePath);
            vo.setiUuid(qUuid);
            sampleService.uploadImg(vo);
            status.setComplete();
        }
    }

    //////////      
    // ?   
    String buy = "";
    int orderSeetPSeq = 0;
    OrderSeetVO vo = new OrderSeetVO();
    vo.setO_id(qName);
    List<OrderSeetVO> orderSeetVOList = sampleService.selectOrderSeetbyId(vo);
    for (int i = 0; i < orderSeetVOList.size(); i++) {
        orderSeetPSeq = orderSeetVOList.get(i).getO_pseq();
        if (selectedId == orderSeetPSeq) {
            buy = "";
        }
    }

    QnaVO qnaVO = new QnaVO(qName, qTitle, qContent, qUuid, qPass, type, buy, selectedId);
    sampleService.insertQnA(qnaVO);

    status.setComplete();

    //   model.addAttribute("main", "egovSampleList.jsp");
    //      return "sample/home";   
    return "forward:/selectProduct.do?searchKeyword2=not&pageIndex=1&selectedId=" + selectedId + "#qna";
}

From source file:egovframework.example.sample.web.EgovSampleController.java

/**
 *  ./*  w w w.j  a  v a 2 s.  c  o  m*/
 * @param sampleVO -    VO
 * @param searchVO - ?    VO
 * @param status
 * @return "forward:/egovSampleList.do"
 * @exception Exception
 */
@RequestMapping("/deleteSample.do")
public String deleteSample(@ModelAttribute("searchVO") SampleDefaultVO searchVO,
        @RequestParam("selectedId") int id, SessionStatus status, Model model) throws Exception {

    SampleVO sampleVO = new SampleVO();
    sampleVO.setbSeq(id);

    //?///////////////////////////////////////////////////////////////////////////////////////////////      

    SampleVO sam2 = new SampleVO();
    sam2 = sampleService.selectSample(sampleVO);

    SampleVO iVo = new SampleVO();
    SampleVO iVo2 = new SampleVO();
    List<SampleVO> imgList = (List<SampleVO>) sampleService.selectImgList(sam2);

    for (int i = 0; i < imgList.size(); i++) {

        int imgSeq = imgList.get(i).getiSeq();
        System.out.println("imgseq======" + imgSeq);
        iVo.setiSeq(imgSeq);
        System.out.println(" ?? ===" + imgList.get(i).getiSeq());
        //? ? ?? 
        iVo2 = sampleService.selectImg(iVo); //? 
        System.out.println(" +? ====" + iVo2.getiUrl());
        File f = new File(iVo2.getiUrl().toString()); //? 
        f.delete(); //? 

        sampleService.deleteImg(iVo);
        status.setComplete();

    }

    //////////////////////////////////////////////////////////////////////////////////////////////////   
    sampleService.deleteSample(sampleVO);
    status.setComplete();

    //   model.addAttribute("main", "goFreebbs.jsp");
    //      return "sample/home";   
    return "forward:/egovSampleList.do";
}

From source file:egovframework.example.sample.web.EgovSampleController.java

@RequestMapping(value = "/boardInsert.do", method = RequestMethod.POST)
public String boardInsert(HttpServletRequest request, Model model,

        @RequestPart(required = false, value = "file") List<MultipartFile> imgFile,
        @ModelAttribute("searchVO") SampleDefaultVO searchVO, @RequestParam("bName") String bName,
        @RequestParam("bPass") String bPass, @RequestParam("bTitle") String bTitle,
        @RequestParam("bContent") String bContent, @RequestParam("bUuid") String bUuid, SessionStatus status

) throws Exception {
    if (!imgFile.isEmpty()) {
        String dir = request.getRealPath("images/egovframework/board_img");
        System.out.println("dd" + imgFile.size());
        for (int i = 0; i < imgFile.size() - 1; i++) {
            //?/* w  w  w  . j a v  a  2s .  co  m*/
            String genId = UUID.randomUUID().toString();

            //?
            String originalFileName = imgFile.get(i).getOriginalFilename();
            //?
            //   String saveFileName = genId+"."+originalFileName;
            String saveFileName = genId;

            //         System.out.println("???="+ originalFileName);
            //         System.out.println("??="+ saveFileName);

            String savePath = dir + "/" + saveFileName;
            imgFile.get(i).transferTo(new File(savePath));
            SampleVO vo = new SampleVO();
            vo.setiOriName(originalFileName);
            vo.setiFileName(saveFileName);
            vo.setiSize((int) imgFile.get(i).getSize());
            vo.setiUrl(savePath);
            vo.setiUuid(bUuid);
            sampleService.uploadImg(vo);
            status.setComplete();
        }
    }

    //////////      
    SampleVO samVO = new SampleVO();
    samVO.setbName(bName);
    samVO.setbPass(bPass);
    samVO.setbTitle(bTitle);
    samVO.setbContent(bContent);
    samVO.setbUuid(bUuid);
    sampleService.insertSample(samVO);
    status.setComplete();

    //   model.addAttribute("main", "egovSampleList.jsp");
    //      return "sample/home";   
    return "forward:/egovSampleList.do";
}

From source file:egovframework.example.sample.web.EgovSampleController.java

@RequestMapping(value = "/boardUpdate.do", method = RequestMethod.POST)
public String updateBoard(@RequestPart(required = false, value = "file") List<MultipartFile> imgFile,
        SessionStatus status, Model model, HttpServletRequest request, @RequestParam("bName") String bName,
        @RequestParam("bPass") String bPass, @RequestParam("bTitle") String bTitle,
        @RequestParam("bSeq") int bSeq, @RequestParam("bContent") String bContent,
        @RequestParam("imgChk") int[] imgChk, @RequestParam("bUuid") String bUuid) throws Exception {
    SampleVO iVo = new SampleVO();
    SampleVO iVo2 = new SampleVO();

    for (int i = 0; i < imgChk.length; i++) {
        //?? 99  99? 

        int imgSeq = imgChk[i];

        switch (imgSeq) {
        case 999:

            break;

        default:// w  w  w  .j  a  v a 2s  .  c o m
            iVo.setiSeq(imgSeq);
            System.out.println(" ?? ===" + imgChk[i]);
            //? ? ?? 
            iVo2 = sampleService.selectImg(iVo); //? 
            System.out.println(" +? ====" + iVo2.getiUrl());
            File f = new File(iVo2.getiUrl().toString()); //? 
            f.delete(); //? 

            sampleService.deleteImg(iVo);
            status.setComplete();
            break;
        }

    }

    SampleVO sampleVO = new SampleVO();
    System.out.println("dd");
    sampleVO.setbSeq(bSeq);
    sampleVO.setbName(bName);
    sampleVO.setbPass(bPass);
    sampleVO.setbTitle(bTitle);
    sampleVO.setbContent(bContent);

    sampleService.updateSample(sampleVO);
    status.setComplete();

    if (!imgFile.isEmpty()) {
        String dir = request.getRealPath("images/egovframework/board_img");
        System.out.println("dd" + imgFile.size());
        for (int i = 0; i < imgFile.size() - 1; i++) {
            //?
            String genId = UUID.randomUUID().toString();

            //?
            String originalFileName = imgFile.get(i).getOriginalFilename();
            //?
            //   String saveFileName = genId+"."+originalFileName;
            String saveFileName = genId;
            String savePath = dir + "/" + saveFileName;
            imgFile.get(i).transferTo(new File(savePath));
            SampleVO vo = new SampleVO();

            vo.setiOriName(originalFileName);
            vo.setiFileName(saveFileName);
            vo.setiSize((int) imgFile.get(i).getSize());
            vo.setiUrl(savePath);
            vo.setiUuid(bUuid);
            sampleService.uploadImg(vo);
            status.setComplete();
        }
    }

    return "forward:/egovSampleList.do";
    //   model.addAttribute("main", "goFreebbs.jsp");
    //   return "sample/home";   
}