LearnFast.Ninja

Java servlet session example

This tutorial example how to create instance of session in java servlet. After creating instance of the session you can check the attribute of your session.

Step 1:
HttpSession session = request.getSession(true);

Step 2:

if (session.getAttribute("MyName") != null)

{

    if (session.getAttribute("MyName").toString() == "true")

    {

        // Some code here...

    }

}


Tags

java

servlet session