Есть сервлет:
@WebServlet("/hello")
public class Main extends HttpServlet{
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
RequestDispatcher requestDispatcher = getServletContext().getRequestDispatcher("/view/createproduct.jsp");
requestDispatcher.forward(req,resp);
}
@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
String s = req.getParameter("name");
String t = req.getParameter("description");
System.out.println(t + " "+s);
resp.sendRedirect("/hello");
}
}
И форма:
<html>
<head>
<title>Title</title>
</head>
<body>
<form action="hello" method="POST">
<input type="text" name="name">
<input type="text" name="description">
<input type="text" name="cost">
<input type="submit" value="Ок">
</form>
</body>
</html>
При получении параметров они всегда null.
Почему не могу получить параметры?
Апостиль в Лос-Анджелесе без лишних нервов и бумажной волокиты
Основные этапы разработки сайта для стоматологической клиники
Продвижение своими сайтами как стратегия роста и независимости