This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

request.getRequestDispatcher

 
david dahwoud
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1258
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What's the URL of the file you're trying to forward to?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64631
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"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
 
david dahwoud
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sorry :-)
 
david dahwoud
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 167
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try:
RequestDispatcher rd = request.getRequestDispatcher("/test.jsp");
 
kumarbobby
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"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
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
test.jsp is well in servlet context path :-(
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Guy Allard
Ranch Hand
Posts: 776
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
David - Are you compiling and building under the 1.5 system, then deploying under the 1.4 runtime?

Guy
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic