The value in session is null. When I write this code in a JSP page, an error occurs.
String user = session.getAttribute("username").toString();
But when I write it like this no error occurs.
String user = (String)session.getAttribute("username");
Why?