web applications - How to make session in Java? -


i need make sessions in java web application.
found sesstion makes in servlet calass method getsession().
have question session parameters. example send server login/pass , save session atributes. okey. next time on client , send new params server. gonna send it? in or same , gonna use if else handle params this?

enter image description here question: how use params put in session(login/pass) in classes?

update

i read sessions. , have new question. how use session params in enother class. mean after login send new params on server, read in servlet , want take login/pass session , send new params class.

as part of request handling in doget or dopost method, here how can session , use , set variables.

//obtain session object, create new session if doesn't exist httpsession session = request.getsession(true);  //set string session attribute session.setattribute("mysessionvariable", "mysessionatrvalue");  //get string sessson attribute string strparam = session.getattribute("mysessionvariable");   //get integer sessioin attribute integer param = (integer) session.getattribute("mysessionvariable");  //set integer session attribute session.setattribute("mysessionvariable", new integer(param.intvalue() + 1)); 

Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -