Reputation: 1573
I'm doing a request forward to another JSP from a JSP with some params in the request object.
JSP1
session.invalidate();
request.setAttribute("errorMessage", "Invalid user or password");
RequestDispatcher requestDispatcher;
requestDispatcher = request.getRequestDispatcher("/userlogin.jsp");
requestDispatcher.forward(request, response);;
userlogin.jsp
<%
if(null!=request.getAttribute("errorMessage"))
{ %>
<div class="alert alert-danger display-hide">
<button class="close" data-close="alert"></button>
<span> <%=request.getAttribute("errorMessage")%> </span>
</div>
<% }
else{
System.out.println("no request");
}
%>
Now Im not able to get the request parms from the request. Its always null in userlogin.jsp. any help?
Upvotes: 0
Views: 116
Reputation: 117
Move session.invalidate() in userLogin.jsp because If you invalidate the session your parameter are not retrieve.
Upvotes: 0