Require login servlet to go to other pages

后端 未结 3 839
孤街浪徒
孤街浪徒 2021-01-29 08:40

There are a million examples on the web that shows how to create a basic Java Login Servlet, where the user has to enter a username and password which gets verified by some data

3条回答
  •  长发绾君心
    2021-01-29 09:27

    After getting the login details from the user, you can save the login details in session and in every page you can test or validate the session like...

    <%
    String strLoginId = (String)session.getAttribute("LoginID");
    String strpassword = (String)session.getAttribute("Password");
    
    if(strLoginId==null)  // Means session is not there
    %>
    
    

提交回复
热议问题