Okay Thanks Craig McClanahan <[EMAIL PROTECTED]> wrote: On 4/1/07, paksegu wrote: > First I was trying to convert a servlet code to pojo so i can call them from > JSF as manage beans but i ran into the problem of ServletContext and > getServletConfig methods and thats where I am stuck at.
When you are in a JSF request, you can get to the ServletContext instance like this: FacesContext fc = FacesContext.getCurrentInstance(); ServletContext sc = (ServletContext) fc.getExternalContext().getContext(); Note that you have to do a cast, because JSF is designed to work on either servlets or portlets. Therefore, you might want to change the second line above to: ExternalContext ec = fc.getExternalContext(); because ExternalContext defines quite a few of the methods on the ServletContext (and ServletConfig) interfaces, which you can call directly. Craig Ransford Segu-Baffoe [EMAIL PROTECTED] [EMAIL PROTECTED] http://www.noqturnalmediasystems.com/ http://www.noqturnalmediasystems.com/Serenade/ https://serenade.dev.java.net/ --------------------------------- Looking for earth-friendly autos? Browse Top Cars by "Green Rating" at Yahoo! Autos' Green Center.
