I'm forwording a sending a request after a click on a form button to a controller servlet and it needs to check if the user is logged in and which button was pressed.
The first part works fine but when im tring to set the result as a parameter and forward the request the JSP page ,the parameter "Button" always returns null. Can someone help me understand why this is happening? maybe there is a better way to do this?
Servlet:
request.setAttribute("Buttons", "Add a new coupon");
request.getRequestDispatcher("/admin_main.jsp").forward(request,response);
JSP:
if (request.getParameter("Buttons") != null) {
// ...
}