2013-06-12 26 views
0

訪問,我在我的動作/控制器類這樣設置一些值要求:SpringWebflow:在RequestContext的設定值 - > HttpServletRequest的是不是JSP

HttpServletRequest request = (HttpServletRequest) context.getExternalContext().getNativeRequest(); 
request.setAttribute("testKey", "testValue"); 

但是,當我試圖從JSP檢索此,我得到空值。

<% 
String testKey = ""+request.getAttribute("testKey"); 
%> 

任何想法,請幫助。

回答

0

研究後,我發現了2種方法來做到這一點: 1)使用相同的ModelAttribute和設定值到context.getFlowScope()賦值來回 2)把(KEY,對象)。 並使用$ {KEY}從JSP中檢索此值(OBJECT)。