Как я могу найти значения для переменной в сеансе или нет?
if(session.getAttribute("tot_demand"))//need to change //if value is already set then do this. else //if not set then do this.
Что мне нужно написать, чтобы код, приведенный выше, работал?
Сравнить с null:
null
if (session.getAttribute("tot_demand") != null) { // already set } else { // not yet set }