• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

cannot use the gotopage method

 
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have tried the servlet gotopage method by Maha, here is the method;
ServletUtilities.gotoPage("/Accounts/list_deputations.jsp",getServletContext(),request,response);public static void gotoPage(String address,ServletContext context,HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException {RequestDispatcher dispatcher = context.getRequestDispatcher(response.encodeURL(address));System.out.println("Dispatch forward to ="+address);dispatcher.forward(request,response);}
I get the following error
java.lang.NullPointerException
at javax.servlet.GenericServlet.getServletContext(GenericServlet.java:205)
at ServletUtilities.gotoPage(ServletUtility.java:81)
the same redirection request works with response.sendRedirect("/Accounts/list_deputations.jsp");
I double checked my tomcat4.0.4 setup with this url:http://www.moreservlets.com/Using-Tomcat-4.html#Servlet-Reloading
Why? and how to solve it?
 
Tongue wrestling. It's not what you think. And here, take this tiny ad. You'll need it.
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic