Question: I need the sessions in my web application not to timeout. They should be there until the user log out manually. It might be a bad call but I must implement it.

I tried the below in web.xml

```
<session-config>
        <session-timeout>
            -1
        </session-timeout>
    </session-config>

```

However the session is still getting time out! Any suggestions?

Answer: 
You can do this too : 

```
<session-config>
    <session-timeout>0</session-timeout>
</session-config>

```

You can see how it works just [here](https://stackoverflow.com/questions/15382895/session-timeout-in-web-xml)
You can also use the following:   

```
HttpSession session = request.getSession();
session.setMaxInactiveInterval(0);

```

or 

```
HttpSession session = request.getSession();
session.setMaxInactiveInterval(-1);

```

![enter image description here](https://i.stack.imgur.com/8KO2I.png)