dcsimg
Accessing a servlet context from a JavaBean
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Joao_Bonina
Posted On:   Wednesday, December 18, 2002 02:30 PM

Is it possible to access a servlet's context from a JavaBean?

Re: Accessing a servlet context from a JavaBean

Posted By:   kevin_rowe  
Posted On:   Thursday, January 23, 2003 04:09 AM

one way to do it is...



make a public method in the bean called init or some such
and make it accept a pageContext object as parameter.



run this from the jsp as <%mybean.init(pageContext);%>



passing in the pageContext object from the local objects.



you can then use bean methods like



pageContext.getServletContext()

pageContext.getResponse()

pagecontext.getRequest()
About | Sitemap | Contact