aspose file tools
The moose likes Servlets and the fly likes problem with the request dispatcher Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Servlets
Reply 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
Ranch Hand

Joined: Dec 16, 2010
Posts: 380
    
    3

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")


"I have a mind like a steel... uh... thingy."
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

 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: problem with the request dispatcher
 
Similar Threads
Bean property problems
I am struggling with this error since 1 week
SQL Server JDBC Connectivity Error
This connection has been closed ERROR!!
Getting an Exception in JSP code.