Answer the question
In order to leave comments, you need to log in
How to display information by servlet on the same page?
there is a post method
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
response.setCharacterEncoding("UTF-8");
response.setContentType("text/html;");
final String textField = request.getParameter("new");
//final String submitButton = request.getParameter("createNew");
//вызываем ответы клиенту с сервера
final PrintWriter out = response.getWriter();
out.print("<div>" + textField + "</div>");
out.close();
}
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>PAAATRYY</title>
</head>
<body>
<form action="CreateEvent" method="post">
<input id = "textField" type="text" name = "new" required placeholder="Hey!"/>
<input id = "submitButt" type="submit" name = "createNew" value = "Create Event"/>
</form>
<div></div>
</body>
</html>
Answer the question
In order to leave comments, you need to log in
Try to call request.setAttribute("label name", "here is what you want to pass, without quotes");
And in .jsp set this label to the right place! Or use scriptlets <%=request.getAttribute("studentsList")%>.
javatalks.ru/topics/16392?page=1#78654
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question