QuestionQ24

VerifiedSecure Coding Practices for Session Management

A developer wrote the following code to handle and maintain a session in the application. What did the developer do in this scenario?

Question Image

Explanation

request.getSession() obtains the current HTTP session, and setAttribute("user", uname) stores the value in uname under the session attribute named user. This maintains state through the session.

Community Discussion

No comments yet. Be the first to start the discussion!