开发者

Seam 2, how to get the servletcontext?

开发者 https://www.devze.com 2023-03-16 17:16 出处:网络
I\'m in seam 2. How can I get the servlet context? I can do this: ServletContexts servletContexts = ServletContexts开发者_JAVA百科.getInstance();

I'm in seam 2. How can I get the servlet context?

I can do this: ServletContexts servletContexts = ServletContexts开发者_JAVA百科.getInstance();

But this is not the ServletContext.


Depending at what moment you are trying to get the ServletContext:

  • During a HttpServletRequest request: ServletContexts.instance().getRequest().getServletContext().

  • During JSF request: (ServletContext)FacesContext.getCurrentInstance().getExternalContext().

  • During application startup: ServletLifecycle.getServletContext().

0

精彩评论

暂无评论...
验证码 换一张
取 消