Click to See Complete Forum and Search --> : Coding login


AlaNio
03-03-2007, 04:45 PM
Hi i currently have a customer table including username / password etc. I want the browser to remember the person logged in. I'm aware that i could use a javabean to store the data and set the scope as session to do this, but i was under the impression that it better to use the session object. can someone give me a quick idea of how to code a simple logon using this.

mickscool
03-04-2007, 10:33 AM
This is the best way to do it:
http://www.webdevelopersjournal.com/articles/logon/xml_jsp_logon.html

HTH

AlaNio
03-04-2007, 11:10 AM
cheers thats helpful but i was wondering if it was better to use the session object. session.setattribute(name, name) etc.

hermoine
03-07-2007, 04:10 AM
when the person logs in you store the username in avariable in the next form. then use session.

sesson.setAttribute("sessionvariable","value");

then sessionvariable can be your own var name. value is which value you want store. If giving a variable then dont give "". Then in any form where you want to retrive the value give

String str=""+session.getAttribute("sessionvariable");

the value retrieved from session is not string hence we add a "" with the session.getA... to convert it to string.

:rolleyes: