sendRedirect JSP

0

I'm doing a chat exercise to test the application.set or get and leave the users and what they write and everything is fine, but I have to make a button to reload the page and I'm not able ...

 
   <form action="verchat.jsp" name="fomchat" method="POST">
      <input type="text" name="texto" placeholder="escribe aquí" value="">
      <input type="submit" name="btnchat" value="Enviar">
    </form>

    <textarea  cols=66 rows=12 name="Texto" placeholder="chat" value=""><%=frase%></textarea><br/>

    <input type="button" name="btnrecarga" value="Recargar">

I've also tried with

if(request.getParameter("btnrecarga") != null){
   response.sendRedirect("http://localhost:8080/ChatWeb/verchat.jsp");
}

and

if(request.getParameter("btnrecarga") != null){
   response.sendRedirect("localhost:8080/ChatWeb/verchat.jsp");
}

and

if(request.getParameter("btnrecarga") != null){
                  response.sendRedirect("verchat.jsp");
                  return;
}

Thank you very much!

    
asked by EduBw 02.10.2017 в 23:53
source

1 answer

0

Make sendRedirect to servlet :

request.sendRedirect("/chat");

Or use the dispatcher:

request
  .getRequestDispatcher("verchat.jsp")
  .dispatcher.forward(request,response);
    
answered by 03.10.2017 / 03:08
source