0

Estoy haciendo un ejercicio de chat para probar el application.set o get y salgan los usuarios y lo que escriben y todo va bien, pero tengo que hacer un botón para que recargue la página y no soy capaz...

   <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">

También he probado con

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

y

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

y

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

Muchas gracias !

1 respuesta 1

0

Has un sendRedirect al servlet:

request.sendRedirect("/chat");

O usa el dispatcher:

request
  .getRequestDispatcher("verchat.jsp")
  .dispatcher.forward(request,response);

Tu Respuesta

By clicking “Publica tu respuesta”, you agree to our terms of service and acknowledge you have read our privacy policy.

¿No es la respuesta que buscas? Examina otras preguntas con la etiqueta o formula tu propia pregunta.