the parameter for setMaxInactiveInterval is expressed in seconds, whereas the one in the deployment descriptor is in minutes.
When we configure session timeout in web.xml, it is applicable to all the sessions created.
When we call setMaxInactiveInterval(int interval) on a session object, then the timeout is set only for that specific session object.
If you have specified a timeout value in web.xml and also calling setMaxInactiveInterval(int interval) on a session object, then for that session object, value set in setMaxInactiveInterval() will be considered for timeout.