There are so many way to handle this.
Process 1
=============
1. Create a hidden filed in your jsp called as "ReqType" .
2.Set value as per Login/Logout request.
2. Read this value in servlet
String type request.getParameter("ReqType")
if("LOGOUT".equals(type)){
}else if("LOGIN".equals(type)){
}
Process 2
=============
1. Assume that requested url are
http://localhost:8080/login
http://localhost:8080/logout
2. add both url pattern in you web.xml file to point the same servlet
3.And read the Uri info in servlet
String uri = request.getRequestURI();
if("/login".equals(uri)){
}else if("/logout".equals(uri)){
}