2014-02-05 24 views

回答

1

試試這個:

@Autowired 
ServletContext servletContext; 
+0

這沒有工作......是否有某種樣本代碼,你可以給我。 – zDroid

+0

當你說它不起作用 - 發生了什麼? –

0

this answer

實現ServletContextAware接口將使Spring注入上下文。

@Controller 
public class ServicesImpl implements Services, ServletContextAware{ 


private ServletContext context; 

public void setServletContext(ServletContext servletContext) { 
    this.context = servletContext; 
} 
相關問題