Thread: login application using servlet jsp for admin/user?

Forum : Servlets   31-10-2017 01:22:02 PM
User Image
Lenovo

Newbie

Joined: Aug 7, 2017

Points: 100

Threads: 6

Posts: 5

Answer Icon login application using servlet jsp for admin/user?

| Quote Date : Oct 31, 2017    Views:466    

I am building an login application for admin and user , how can I use session for logout , so when I go back the page user profile should not display.. please answer .?
     

tags: servlet

Comments

User Image
Ashok1207

Newbie

Joined : Apr 20, 2017

Points : 145

Threads: 9

Posts: 54

Answer IconRe: login application using servlet jsp for admin/user?

Reply Date : Nov 6, 2017

Session Invalidating:
-----------------------
   There are two ways of invalidating a session.
   
   -->Programmatic approach
   
   --->Declarative approach
   
   Programmatic Approach:
   ----------------------
                    We can use session.invalidate() or session.setMaxInactiveInterval(seconds).By default for every server the default time out is 30 ms.
Declarative Approach:
---------------------
                We can configure these tags in web.xml.

                     <web-app>
                     <session-config>
                     <session-timeout>20</session-timeout>  
</session-config>
</web-app>
 
  In order to not display the profile when back button is pressed.We should block the back button which is commonly used in banking applications.
 This can be achieved multiple ways one of the way to use in java script is

   <SCRIPT type="text/javascript">
window.history.forward();
function noBack() { window.history.forward(); }
</SCRIPT>
</HEAD>
<BODY onload="noBack();"
onpageshow="if (event.persisted) noBack();" onunload="">?

Load More

No More Comments