2014-08-29 61 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?我尝试这一点,但我得到一个空值:

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

回答

0

ModelAndView属性(并最终基本地图)的基础上的信息存储,默认情况下它是request scoped

所以去 -

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

或者,如果你想找到存在于任何范围的属性,然后试戴

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