2014-08-29 2 views
0

나는 이런 식으로, (내 스프링 컨트롤러에서) 내보기에 매개 변수를 전달하는 경우 :읽기 매개 변수

mav.addObject("command", serv.getNewObject()); 

또는

mav.addObject("command", serv.getObject(id)); 

내보기

<custom:MainForm action="..." classe="..."> 
    <custom:FieldBox ordem="..."> 
     ... 
     <custom:Input/> 
     ... 
    </custom:Fieldbox> 
</custom:MainForm> 

나는 사용자 정의 태그 내부에이 매개 변수 command에 액세스 할 수 있습니다 방법 :이 같은 사용자 정의 태그를 사용할 수 있습니까? 그래서 갈 기본적으로는 request scoped

입니다

Object object = pageContext.getAttribute("command"); 

답변

0

ModelAndView 특성 (결국 기본 맵) 정보를 기반으로 저장됩니다 -

:이 시도,하지만 난 null 값을 얻고있다 당신이 범위의에 존재하는 속성을 찾으려면
Object object = pageContext.getRequest().getAttribute("command"); 

또는 다음 try-

Object object = pageContext.findAttribute("command");//will search for attribute in all scope page,request and session