i have a login,jsp and the servlet check_loginservlet checks whether the user is valid or invalid. In case of invalid login i want it to directed to login.jsp itself but with error message displayed. If i set the error message in session and do session.getAttribute("error") in the jsp it displays null there first time. So what is the way to avoid null display. Do i need to have java code here saying if it is null then do not display anything else display it.