I am facing with the issues is Iam showing a error message in the page(newpwd.jsp) via
request.getSession().setAttribute("currpwderror", "Enter Correct Password");
it is showing first time with out any problem. But at the second time loading this(newpwd.jsp) page this message shown there. the message should not be shown there on loading.
I know this problem is because of not clearing the session. But I don’t know the solution
Please help me.
In jsp:
<span style="color:#FF0000; align:right" id="lblmsg_log">${currpwderror }</span>
java
request.getSession().setAttribute("currpwderror", "Enter Correct Password");
ModelAndView modelAndView = new ModelAndView("redirect:"+projectUrl+"newpwd.html");
return modelAndView;
You should be setting the error in your request/response cycle. I mena the response you are sending back ideally. Session is not the place for that.