File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes RequestDispatcher forward problem ! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of JavaScript Promises Essentials this week in the JavaScript forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "RequestDispatcher forward problem !" Watch "RequestDispatcher forward problem !" New topic
Author

RequestDispatcher forward problem !

Frank Jacobsen
Ranch Hand

Joined: May 17, 2002
Posts: 353
RequestDispatcher dispatcher = getServletContext().getRequestDispatcher("XabridgeView.jsp");
// The dispatcher gets an null pointer exception bellow:
dispatcher.forward(request, response);
I Dont understand this i have look at the web xml, that looks fine, and tried with the syntaks:
RequestDispatcher dispatcher = getServletContext().getRequestDispatcher("/XabridgeView.jsp");
don�t work !
I can call the JSP page with the following url: http://localhost:7001/Xabridge/XabridgeController
I have also tried with the following syntaks:
RequestDispatcher dispatcher = getServletContext().getRequestDispatcher("Xabridge/XabridgeView.jsp");
and
RequestDispatcher dispatcher = getServletContext().getRequestDispatcher("/Xabridge/XabridgeView.jsp");
Nothing works ???
Here is the web.xml:
web-app>
<servlet>
<servlet-name>XabridgeController</servlet-name>
<servlet-class>XabridgeController</servlet-class>
</servlet>
<servlet>
<servlet-name>XabridgeView</servlet-name>
<jsp-file>XabridgeView.jsp</jsp-file>
</servlet>
<servlet-mapping>
<servlet-name>XabridgeController</servlet-name>
<url-pattern>XabridgeController</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>XabridgeView</servlet-name>
<url-pattern>XabridgeView.jsp</url-pattern>
</servlet-mapping>
HEEEELP !!!
Frank Jacobsen
Ranch Hand

Joined: May 17, 2002
Posts: 353
Stupid me !
I found the solution !
RequestDispatcher dispatcher = getServletContext().getRequestDispatcher("/XabridgeView.jsp");
I had a classpath in the startweblogic.cmd to an old servlet, so everytime, i tried, the old servlets was running, and not the new, in the .war file.

Frank Jacobsen
SCJP2
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: RequestDispatcher forward problem !