jeudi 30 juillet 2015

Forward results from servlet to jsp in java EE 7

I am developing a small web application using jsps and servlets. I upload a file from welcome page and process it in a servlet. Late I forward the result to another page using the following code.

protected void doPost(HttpServletRequest request,
        HttpServletResponse response)
        throws ServletException, IOException
{
    processRequest(request, response); // data is processed in this method

    RequestDispatcher oRD = request.getServletContext().getRequestDispatcher("/displayResult.jsp");
    oRD.forward(request, response);
}

My servlet is located in a folder named "Main" in source package and the jsp is located in Web Pages folder outside the WEB-INF folder.

This does not show any error and the control is not transferred to the jsp page as well. I have tried by using different paths but it does not show anything.

There is no web.xml file, as I am using JAVA-EE-7

Thanks in advance.

Aucun commentaire:

Enregistrer un commentaire