Session attribute 에러질문
- 작성자 :
- 장*정
- 작성일 :
- 2009-11-24 21:24:45
- 조회수 :
- 5,221
- 구분 :
- 실행환경
- 진행상태 :
- 완료
Q
소스
@Controller
@SessionAttributes(types=ComCdGrpVO.class)
public class AdmComCdGrpMngCtrl {
@Resource(name = "comCdGrpMngService")
private ComCdGrpMngService comCdGrpMngService;
@Resource(name = "propertiesService")
protected EgovPropertyService propertiesService;
@Resource(name = "beanValidator")
protected DefaultBeanValidator beanValidator;
protected Log log = LogFactory.getLog(this.getClass());
@RequestMapping(value="/COMCD0100N.do")//코드그룹조회
public String selectCodeGrpList(@ModelAttribute("xComCdVo") XComCdVO xComCdVo,
ModelMap model)
throws Exception {
....
return "/gsbc/com/cd/COMCD0100N";
}
@RequestMapping("/COMCD0300N.do")
public String insertCodeGrp(
@ModelAttribute("xComCdVo") XComCdVO xComCdVo,
ComCdGrpVO comCdGrpVO,
BindingResult bindingResult, Model model, SessionStatus status)
throws Exception {
....
return "/gsbc/com/cd/COMCD0300N";
}
----------------------------------------------------
에러
2009-11-24 21:04:10,968 DEBUG [org.springframework.web.servlet.DispatcherServlet] Handler execution resulted in exception - forwarding to resolved error view: ModelAndView: reference to view with name 'cmmn/bizError'; model is {exception=org.springframework.web.HttpSessionRequiredException: Session attribute 'comCdGrpVO' required - not found in session}
org.springframework.web.HttpSessionRequiredException: Session attribute 'comCdGrpVO' required - not found in session
at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter$ServletHandlerMethodInvoker.raiseSessionRequiredException(AnnotationMethodHandlerAdapter.java:550)
at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.resolveModelAttribute(HandlerMethodInvoker.java:365)
at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.resolveHandlerArguments(HandlerMethodInvoker.java:210)
at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:132)
at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:326)
at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:313)
....
@Controller
@SessionAttributes(types=ComCdGrpVO.class)
public class AdmComCdGrpMngCtrl {
@Resource(name = "comCdGrpMngService")
private ComCdGrpMngService comCdGrpMngService;
@Resource(name = "propertiesService")
protected EgovPropertyService propertiesService;
@Resource(name = "beanValidator")
protected DefaultBeanValidator beanValidator;
protected Log log = LogFactory.getLog(this.getClass());
@RequestMapping(value="/COMCD0100N.do")//코드그룹조회
public String selectCodeGrpList(@ModelAttribute("xComCdVo") XComCdVO xComCdVo,
ModelMap model)
throws Exception {
....
return "/gsbc/com/cd/COMCD0100N";
}
@RequestMapping("/COMCD0300N.do")
public String insertCodeGrp(
@ModelAttribute("xComCdVo") XComCdVO xComCdVo,
ComCdGrpVO comCdGrpVO,
BindingResult bindingResult, Model model, SessionStatus status)
throws Exception {
....
return "/gsbc/com/cd/COMCD0300N";
}
----------------------------------------------------
에러
2009-11-24 21:04:10,968 DEBUG [org.springframework.web.servlet.DispatcherServlet] Handler execution resulted in exception - forwarding to resolved error view: ModelAndView: reference to view with name 'cmmn/bizError'; model is {exception=org.springframework.web.HttpSessionRequiredException: Session attribute 'comCdGrpVO' required - not found in session}
org.springframework.web.HttpSessionRequiredException: Session attribute 'comCdGrpVO' required - not found in session
at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter$ServletHandlerMethodInvoker.raiseSessionRequiredException(AnnotationMethodHandlerAdapter.java:550)
at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.resolveModelAttribute(HandlerMethodInvoker.java:365)
at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.resolveHandlerArguments(HandlerMethodInvoker.java:210)
at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:132)
at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:326)
at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:313)
....
A
안녕하세요.. 장태정님..
SessionAttributes에서 types에 대한 API를 보면.. 다음과 같이..
model attributes로 지정된 것들이 대상이 됩니다.
All model attributes of this type will be stored in the session, regardless of attribute name
즉.. ComCdGrpVO 파라미터 부분을 ModelAttribute로 지정하시거나..
명시적으로 모델에 추가된(addAttribute 등)경우만.. SessionAttributes에 대상이 됩니다.
그럼.. 즐거운 하루 되십시오.
감사합니다..
SessionAttributes에서 types에 대한 API를 보면.. 다음과 같이..
model attributes로 지정된 것들이 대상이 됩니다.
All model attributes of this type will be stored in the session, regardless of attribute name
즉.. ComCdGrpVO 파라미터 부분을 ModelAttribute로 지정하시거나..
명시적으로 모델에 추가된(addAttribute 등)경우만.. SessionAttributes에 대상이 됩니다.
그럼.. 즐거운 하루 되십시오.
감사합니다..