session management

G

gandhi.pathik

Hi friends

can anyone give me idea regarding how to manage session from user's
login to signout.

also how to handle security issues.

My project is based on java, servlet , jsp and jdbc.

with thanks
pathik s gandhi
 
S

Sanjay

Hi friends

can anyone give me idea regarding how to manage session from user's
login to signout.

Use HttpSession or you can also maintain your own session abstraction
through a session cookie.

Let me assume you are using Servlet

then you can write something like this

public void doGet(HttpServletRequest request, HttpServletResponse
response)
{
HttpSession session = request.getSession(true);
...
//Manage your user identity
}

or

public void doGet(...)
{
Cookie[] cookieList = request.getCookie();
...//search for your cookie
if ("MY_COOKIE_NAME".equals(cookieList[index])
{
//my session is present, now validate to check if this is not
timed out.
}
}
also how to handle security issues.

I am not sure what kind of security you are looking at, by my idea is
to use HTTP S protocol.
My project is based on java, servlet , jsp and jdbc.

with thanks
pathik s gandhi

Sanjay
 
S

Sanjay

Sanjay said:
Hi friends

can anyone give me idea regarding how to manage session from user's
login to signout.

Use HttpSession or you can also maintain your own session abstraction
through a session cookie.

Let me assume you are using Servlet

then you can write something like this

public void doGet(HttpServletRequest request, HttpServletResponse
response)
{
HttpSession session = request.getSession(true);
...
//Manage your user identity
}

or

public void doGet(...)
{
Cookie[] cookieList = request.getCookie();
...//search for your cookie
if ("MY_COOKIE_NAME".equals(cookieList[index])

this should have been
"MY_COOKIE_NAME".equals(cookieList[index].getName())
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top