1. RequestDispatcher 객채를 이용한 forward 방법.
request.setAttribute(String, Object); request.getRequestDispatcher("/WEB-INF/***.jsp").forward(request, response);
getRequestDispatcher() 파라메터 값으로 포워드 할 주소를 적어준다. webapp 이후 경로 부터 적어준다.
2. ModelAndView 객체를 이용한 방법.
ModelAndView mv = new ModelAndView("뷰페이지"); mv.addObject(attributeName, attributeValue) throw new ModelAndViewDefiningException(mv);
3. HttpServletResponse 객체를 이용한 sendRedirect 방법
response.sendRedirect("포워드 할 주소");
4.HttpServletResponse 객체를 이용한 ReFresh 방법
response.addHeader("Refresh", "1;url=포워드할 주소");
'SPRING' 카테고리의 다른 글
Validator 클래스에서 Service객체 의존성 주입 방법 (0) | 2020.06.29 |
---|---|
lombok 사용 시 두번째 단어 대문자 일 경우 EL 표현식에서 객체 접근 시 javax.el.PropertyNotFoundException일 경우 (0) | 2020.05.17 |
마이바티스(Mybatis)연동하기 (0) | 2020.05.07 |
스프링 프로젝트 생성방법 (0) | 2020.05.03 |
이클립스 톰캣 연동 (0) | 2020.05.01 |
댓글