2010-09-10 33 views
0

我想在web.xml中獲取上下文參數配置。在方法調用正常(有縫2.2.0),我這樣做:在異步方法seam中獲取上下文參數

readDirectory = (String) FacesContext.getCurrentInstance() 
       .getExternalContext().getInitParameter(
         "ReadDirectory"); 

它的做工精細,但在異步方法(@Asynchronous)我faceContext爲空。

所以我不知道如何得到這個參數。

回答

2

我發現:

ServletLifecycle.getServletContext().getInitParameter("ReadDirectory"); 

容易當你知道^^