I have an HTML page in which a feedback form is written, I’ll do a check for filling a form in JavaScript, and what's next - from pressing the “send” button and before receiving the letter by e-mail ??? It is required to do form processing (server side) without PHP, and using JSP, servlets ..., as well as captcha (without PHP). In this I am a full "0". If there is material (you can video) on the server, how the form is processed, where the code is inserted - in great detail, I will be very happy to get it or tell me where to find it. Thank you so much. Good luck to you!
2 answers
Discarding all the details, create a page layout:
<form action="someservlet" method="post"> <input type="text" name="address" value="${param.address}" ${not empty messages.succes ? 'disabled' : ''}> <p class="error">${messages.address}</p> <input type="submit"> <p class="succes">${messages.succes}</p> </form> and add processing
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { Map<String, String> messages = new HashMap<String, String>(); request.setAttribute("messages", messages); String address = request.getParameter("address"); if (address == null || address.trim().isEmpty()) { messages.put("address", "Пожалуйста, заполните поле"); } if (messages.isEmpty()) { // Сформировать текст сообщения и отправить на почту messages.put("succes", "Сообщение успешно отослано"); } request.getRequestDispatcher("somepage.jsp").forward(request, response); } You also need the captcha and the mail API itself. About JSP read at least here: JSP . :)
|
Try looking at this: Overview of the Mail API for Java .
|