Package javax.servlet

Examples of javax.servlet.RequestDispatcher.forward()


    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

        try {
            request.setAttribute("type", tax.getRate());
            RequestDispatcher dispatcher = getServletContext().getRequestDispatcher("/result.jsp");
            dispatcher.forward(request, response);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
View Full Code Here


            request.setAttribute("infoMessage", "");
            e.printStackTrace();
        } finally {
            request.setAttribute("errorMessage", errorMessage.toString());
            RequestDispatcher resultView = request.getRequestDispatcher("index.jsp");
            resultView.forward(request, response);
        }
    }

}
View Full Code Here

        if (rd != null) {
            /*
             * Forward the request to default servlet handling calls to application root. In our case FacesServlet
             */
            rd.forward(req, resp);
            return;
        } else {
            // this is bad thing, lets throw exception to make user aware of that?
            throw new IllegalStateException("Container is not well!");
        }
View Full Code Here

      throws ServletException, IOException {
    request.setAttribute("error.msg", errMsg);
    RequestDispatcher dispatcher = request.getRequestDispatcher(
        "/job_authorization_error.jsp");
    response.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
    dispatcher.forward(request, response);
  }

  /**
   * Method used to process the request from the job page based on the
   * request which it has received. For example like changing priority.
View Full Code Here

            // Perform cross context dispatch to another context
            // Over there we will check that the session attribute added above is not visible
            ServletContext contextB = getServletContext().getContext("/contextB");
            RequestDispatcher dispatcherB = contextB.getRequestDispatcher(request.getServletPath());
            dispatcherB.forward(request, response);

            // Check that we don't see things put in session by contextB
            Object objectB = session.getAttribute("B");
            assert objectB == null;
            System.out.println("A: session.getAttributeNames() = " + Collections.list(session.getAttributeNames()));
View Full Code Here

                            if (included.booleanValue())
                                dispatcher.include(request,response);
                            else
                            {
                                request.setAttribute("org.mortbay.jetty.welcome",ipath);
                                dispatcher.forward(request,response);
                            }
                        }
                    }
                }
                else
View Full Code Here

                        httpResponse.addHeader("LogginError", WebappUtil.getMessage("login_error"));
                       
                        RequestDispatcher requestDispatcher=httpRequest.getRequestDispatcher("/login.jsp?accessingURL=" +
                                httpResponse.encodeURL(accessingURL) + "&loginError=" +
                                httpResponse.encodeURL(WebappUtil.getMessage("login_error")));
                        requestDispatcher.forward(httpRequest, httpResponse);
                        return;
                    }
                }
               
            } else if(!securityHandler.isPersonLoggedIn(httpRequest)) {
View Full Code Here

                        // need to login to get to these page
                        //??? todo, need pathinfo and querystring
                        // what about post payload if an event is being submitted for creation
                        RequestDispatcher requestDispatcher=httpRequest.getRequestDispatcher("/login.jsp?accessingURL=" +
                                httpResponse.encodeURL(getAccessURL(httpRequest)));
                        requestDispatcher.forward(httpRequest, httpResponse);
                        return;
                    }
                }
            }
           
View Full Code Here

            throw new ServletException("No RequestDispatcher can be created for path " + pathInfo);
        }
        try {
            HttpServletRequestFilter servletRequest =
                new HttpServletRequestFilter(request, pathInfo, theServletPath);
            rd.forward(servletRequest, response);
        } catch (Throwable ex) {
            throw new ServletException("RequestDispatcher for path " + pathInfo + " has failed");
        }  
    }
   
View Full Code Here

        request.setAttribute( "subjects", bzb.getSubjects() );
       
        /* Set up forward and display JSP */
        dispatcher = getServletContext().getRequestDispatcher( forwardUrl );

        dispatcher.forward( request, response );
    }
   
    /**
     * Handles all incoming GET requests to the servlet.
     *
 
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.