MVC(2)
-
[ Java ] Controller에서 다른 Controller redirect 방법
Controller에서 다른 Controller로 redirect를 할 때 단순히 redirect만 쓰면 되지 않습니다. 다음과 같이 RedirectView를 사용하면 다른 Controller로 redirect 할 수 있습니다. ModelAndView mav = new ModelAndView(); mav.setView(new RedirectView("/abc/defg/hijklm.do")); return mav;
2020.03.27 -
[ Ajax ] JAVA Controller에서 json 형식으로 데이터 가져오기
Ajax 부분 $.ajax({ type: "POST", url: url, data: data, dataType: 'json', success: function(data){ data.키값; }, error: function(request, status, error){ alert(request.status + "#" + request.message + "#" + error); } }) Controller 부분 @RequestMapping(url) @ResponseBody public String functionName(...)throws Exception{ ... HashMap hashMap = new HashMap(); hashMap.put("키값", 값); return JSONObject.fromObje..
2019.10.28