0

I have a Login.jsp page which has the action="session.jsp" set for a login form.

In the Login page, the session parameters are set as

<% String username = request.getParameter("username"); session.setAttribute("username", username); %> 

Now when I try to access these values in the session page

Welcome <%= session.getAttribute("username") %> 

I get a Welcome null

Any thoughts?

2 Answers 2

2

If the form is in the Login.jsp, there's no use in setting the session attribute there, if username is a field you're passing as parameter to the session.jsp. It will only be available as a parameter once session.jsp is invoked. Seeing some more code will help, if that is not the issue.

Sign up to request clarification or add additional context in comments.

Comments

0

use <%=session.getAttribute("username").toString()%>

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.