aspose file tools*
The moose likes Servlets and the fly likes request.getRequestDispatcher Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "request.getRequestDispatcher" Watch "request.getRequestDispatcher" New topic
Author

request.getRequestDispatcher

david dahwoud
Greenhorn

Joined: Jul 07, 2005
Posts: 4
On configuration Apache Tomcat/5.5.9 jre 1.5.0_02-b09 Windows XP, webapps work like a charm.

But on configuration Tomcat/5.0.27 1.4.2_05-b04 Linux Debian, i always have a NullPointerException when using request.getRequestDispatcher(URL).forward(request,response)

I don't know why and you ?

thanks
Nathaniel Stoddard
Ranch Hand

Joined: May 29, 2003
Posts: 1258
What's the URL of the file you're trying to forward to?


Nathaniel Stodard<br />SCJP, SCJD, SCWCD, SCBCD, SCDJWS, ICAD, ICSD, ICED
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60053
    
  65

"dahwoud dahwoud",

There aren't may rules that you need to worry about here on the Ranch, but one that we take very seriously regards the use of proper names. Please take a look at the JavaRanch Naming Policy and adjust your display name to match it.

In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.

Thanks!
bear
Forum Bartender


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
david dahwoud
Greenhorn

Joined: Jul 07, 2005
Posts: 4
sorry :-)
david dahwoud
Greenhorn

Joined: Jul 07, 2005
Posts: 4
minimal test servlet



the test.jsp used as forward



test.jsp location:

WebApp directory
|---------------test.jsp
|---------------WEB-INF

getRequestDispatcher from request or servletContext throw nullpointerexception
[ July 07, 2005: Message edited by: david dahwoud ]
Sharad Agarwal
Ranch Hand

Joined: Sep 11, 2002
Posts: 167
Try:
RequestDispatcher rd = request.getRequestDispatcher("/test.jsp");


Alco-Haul: We move spirits.
Demented Deliberations of a Dilettante
kumarbobby
Greenhorn

Joined: Jul 07, 2005
Posts: 11
Hi,
genarally we will write the Request dispatcher in servlet by

public void doGet(HttpServletRequest req,HttpServletResponse res)throws ServletException
{
RequestDispatcher rd=req.getRequestDispatcher("some jsp file");
rd.forward(req,res);
}

i think that in your case u have misplaced the jsp file so u put the jsp page under context path and try it
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

"kumarbobby",
You have changed your display name from "vinay krothapalli kumar" and unfortunately your new display name is not valid. Please change it back, since accounts with invalid display names get deleted.

thanks,
Dave.
david dahwoud
Greenhorn

Joined: Jul 07, 2005
Posts: 4
test.jsp is well in servlet context path :-(
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Originally posted by dahwoud dahwoud:
On configuration Apache Tomcat/5.5.9 jre 1.5.0_02-b09 Windows XP, webapps work like a charm.

But on configuration Tomcat/5.0.27 1.4.2_05-b04 Linux Debian, i always have a NullPointerException when using request.getRequestDispatcher(URL).forward(request,response)

I don't know why and you ?

thanks


Is '1.4.2_05-b04' a full j2sdk or is it just a JRE?
Tomcat 5.0x requires a full JDK (j2sdk) to compile JSPs.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Guy Allard
Ranch Hand

Joined: Nov 24, 2000
Posts: 776
David - Are you compiling and building under the 1.5 system, then deploying under the 1.4 runtime?

Guy
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: request.getRequestDispatcher
 
Similar Threads
servlet path
Inavlid Datasource Reference (Naming Exception)
what are the configuration for need to tomcat to run?
Maven Tomcat Plugin Issue
Question on BUTTON name/value pairs sent from JSP