dcsimg
Servlet Architecture
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Chad_Campbell
Posted On:   Saturday, January 25, 2003 06:22 AM

Hello! I have a unique problem that I am trying to solve. I have created a 3 classes. We will name them ClassA, ClassB, and ClassC respectively. Here is the situation. ClassA is the root of all of the Classes, ClassA extends HttpServlet. ClassB and ClassC both extends ClassA. There are methods in ClassA that I want both ClassB and ClassC to have access to. The twist is that I need ClassB to have access to classBs methods. The trick is, I need both ClassB and ClassC to have access to a print type method I have in ClassA, this print method forwards a request. If I create a new ClassC() from ClassB and call ClassC.method from ClassB and when in that method, if ClassAs print method is called from ClassB, a null pointer exce   More>>

Hello!

I have a unique problem that I am trying to solve. I have created a 3 classes. We will name them ClassA, ClassB, and ClassC respectively. Here is the situation. ClassA is the root of all of the Classes, ClassA extends HttpServlet.

ClassB and ClassC both extends ClassA. There are methods in ClassA that I want both ClassB and ClassC to have access to. The twist is that I need ClassB to have access to classBs methods.

The trick is, I need both ClassB and ClassC to have access to a print type method I have in ClassA, this print method forwards a request. If I create a new ClassC() from ClassB and call ClassC.method from ClassB and when in that method, if ClassAs print method is called from ClassB, a null pointer exception is thrown. The null pointer is thrown on the following line:


RequestDispatcher dispatcher = getServletContext().getRequestDispatcher(pageName);


where pageName is a url. I need to use ClassC with other Classes that is why I have not scrapped it.

I know that this description has been pretty messy and a bit confusing. Thank-you for any help you can provide.

   <<Less

Re: Servlet Architecture

Posted By:   Christopher_Koenigsberg  
Posted On:   Monday, January 27, 2003 07:01 AM

So, which value was null, causing the exception?

About | Sitemap | Contact