Issue
I have a login page named login.jsp for the customer to login.
The checklogin.jsp page where I am checking the user id and password to enter into the customer UI.
I want to have user the username and other details in my servlet.
How can I get this details in servlet page? The JSP and servlet are simple registration form. I want username and details who is filling the form.
Solution
once you know the user data store it as an attribute: for ex:
<%=request.getSession().setAttribute("currentUser", username);%>
then try use this command:
<%= request.getSession().getAttribute("currentUser"); %>
use this code to watch all attributes on console page:
<%=Session session = request.getSession();
Enumeration attributeNames = session.getAttributeNames();
while (attributeNames.hasMoreElements()) {
String name = attributeNames.nextElement();
String value = session.getAttribute(name);
System.out.println(name + "=" + value);}%>
cheers :)
Answered By - UMichaeli
Answer Checked By - Clifford M. (JavaFixing Volunteer)