my dog learned polymorphism*
The moose likes Servlets and the fly likes problem with the request dispatcher Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "problem with the request dispatcher" Watch "problem with the request dispatcher" New topic
Author

problem with the request dispatcher

rajesh thallamapuram
Greenhorn

Joined: Mar 06, 2012
Posts: 10
org.apache.jasper.JasperException: An exception occurred processing JSP page /StatusTRAN.jsp at line 13

10: request.setAttribute("trackid",request.getParameter("merchantreferenceno"));
11: request.setAttribute("amt",request.getParameter("amount"));
12: RequestDispatcher rd=request.getRequestDispatcher("../saveResponse.fly");
13: rd.forward(request,response);
14: %>
15: </BODY>
16: </HTML>


Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:568)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:470)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)

root cause

java.lang.NullPointerException
org.apache.jsp.StatusTRAN_jsp._jspService(StatusTRAN_jsp.java:76)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)


I'm getting NullPointer Exception while forwarding requesting dispatcher please give me suggestion why it is happeninig?

please help me...
J. Kevin Robbins
Bartender

Joined: Dec 16, 2010
Posts: 920
    
  13

Double check the path to saveResponse.fly. It has to be relative to StatusTRAN.jsp.

You could try putting them in the same directory and then doing RequestDispatcher rd=request.getRequestDispatcher("saveResponse.fly")


"The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do." -- Ted Nelson
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

what is the values for these Parameters? . I doubt either of any one may return null.


Note: Putting Java Code in a Jsp is Poor Practice. Use Java classes for Java Code and access the classes from your backend/servlet and forward the return values to JSP for display
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

Welcome to JavaRanch rajesh thallamapuram
rajesh thallamapuram
Greenhorn

Joined: Mar 06, 2012
Posts: 10
I'm getting both the values.. and I kept statusTran.jsp inside webcontent --> payment gateway folder..

yeah putting the java code inside jsp is not good.. but, for the payment gateway i have to use JSP only....
rajesh thallamapuram
Greenhorn

Joined: Mar 06, 2012
Posts: 10
yes i kept the both jsp's in same folder. I'm accessing second using web.xml file because while executing the code in public server i'm getting some problems. So, through the web.xml I'm accessing.
rajesh thallamapuram
Greenhorn

Joined: Mar 06, 2012
Posts: 10
Any way I have decided to change my logic. Instead of forward i'm redirecting to jsp page and I used session to store attributes.

Thanks for your help

 
 
subject: problem with the request dispatcher