This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes Servlets and the fly likes ServletExec and RequestDispatcher Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "ServletExec and RequestDispatcher" Watch "ServletExec and RequestDispatcher" New topic
Author

ServletExec and RequestDispatcher

Sair Legge
Greenhorn

Joined: Nov 23, 2001
Posts: 4
I'm using ServletExec to process my Servlets/JSPs and am having problems using the following code to forward a request on:
RequestDispatcher dispatcher = request.getRequestDispatcher(address);
dispatcher.forward(request, response);
If I put the servlet class in the default servlets directory it works no problem, however if I configure a Web Application and put the servlet class in the WEB-INF\classes directory it throws a NullPointerException as the getRequestDispatcher method returns NULL.
Any ideas why it works as a 'stand-alone' servlet but not as part of an app?
Kaustubh Patil
Ranch Hand

Joined: Aug 13, 2001
Posts: 164
Try checking the servlet mapping in in the web.xml file. Also chk the path u are specifying while constructing the RequestDispatcher.
-Kaustubh


Kaustubh. Mumbai, India.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: ServletExec and RequestDispatcher
 
Similar Threads
Deploying applets with Tomcat
JSP will not run
Implementing SSL
Whats Equavllent Directory in ServletExec for PUBLIC_HTML directory files in Jws 2.0
Whats Equavllent Directory in ServletExec for PUBLIC_HTML directory files in Jws 2.0