3 Replies Latest reply on Nov 25, 2001 12:14 PM by Kai Unewisse

    503 Service Unavailable

    Kai Unewisse Newbie

      HI !

      I want to use a Servlet to invoke JSP's using this code:

      public void doGet(HttpServletRequest request,
      HttpServletResponse response)
      throws ServletException, IOException {
      String operation = request.getParameter("operation");
      if (operation == null) {
      operation = "unknown";
      if (operation.equals("operation1")) {
      request, response);
      } else if (operation.equals("operation2")) {
      request, response);
      } else {
      request, response);

      private void gotoPage(String address,
      HttpServletRequest request,
      HttpServletResponse response)
      throws ServletException, IOException {
      RequestDispatcher dispatcher =
      dispatcher.forward(request, response);

      When I send something to my servlet to invoke one of the pages the result is 503 Service Unavailable Nullpointer Exception in the last line of gotoPage (dispatcher.forward()).

      I guess that I need another path for the jsp than now.
      I put them now together with the servlet in the WAR.

      I am using Jetty.

        • 1. Re: 503 Service Unavailable
          Andreas Schaefer Apprentice

          Right now I would guess it is a problem with path how you access your JSP pages.

          You use relative paths to access to JSP pages. By using the RequestDispatcher the Servlet and JSP pages must be deployed within the same application. Then the use of the relative path teh JSP pages must be on the same path the Servlet was.

          - call your servlet
          - replace the SERVLET NAME with either "presentation1.jsp" or the other JSP pages
          If this fails then your path to the JSP pages is not correct.

          Whenever you want to access a JSP page in another application you cannot use the RequestDispatcher. You have to use either HttpServletResponse.sendRedirect() or use the browser.

          Have fun - Andy

          • 2. Re: 503 Service Unavailable
            Kai Unewisse Newbie

            Thanks Andreas !
            Hope you had a nice happy turkey day.

            As you guessed I have a problem with the path to the JSP's.

            How can I correct it? Do I have to specify the path somewhere or have the JSP in a special folder ?
            My JSP and Servlet are in one application.

            Thanks in advance, Kai

            • 3. Re: 503 Service Unavailable
              Kai Unewisse Newbie

              I figured out, that my ant caused the problem.