samedi 11 juillet 2015

Java EE - RequestDispatcher inside html body

I just don't know how to put the response of the RequestDispatcher inside the html body of my jsp. That is my model:

RequestDispatcher view = request.getRequestDispatcher("/Overview.jsp");
    view.forward(request, response);
    PrintWriter out= response.getWriter();

    response.setContentType("text/html");

    if (count!=0){
        int i = 1;
        while (i <= count){
            out.println("<div>Name: "+batch.getName()+"</div>");
            i++;
        }
    }
    else{
        out.println("<div><font colour=blue>No Batch</font</div>");
    }

When I run the Servlet my jsp looks something like this:

<html>...
<body>
....
</body>
</html>
<div>....

How am I able to put the divs inside of the body?

Aucun commentaire:

Enregistrer un commentaire