Yuvalxp8 icon

Login + User Counter

Yuvalxp8 | PRO | 01/23/17 02:29:51 PM UTC | 0 ⭐ | 420 👁️ | Never ⏰ | []
Java |

1.98 KB

|

None

|

0 👍

/

0 👎

<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
        <link rel="stylesheet" type="text/css" href="cssForTopBar.css">
        <title>Login</title>
    </head>
        <body>
            <h2>Please Login: </h2>
            <hr>
                <form id= "login" method="get" action="loginCheck.jsp">
            <center>
                <table border="1" width="30%" cellpadding="3">
                    <th>
                        <tr>
                            <th colspan="2">Login Here</th>
                        </tr>
                    </th>
                    <tb>
                        <tr>
                            <td>User Name</td>
                            <td><input type="text" name="uname" value="" /></td>
                       </tr>
                        <tr>
                            <td>Password</td>
                            <td><input type="password" name="pass" value="" /></td>
                        </tr>
                        <tr>
                            <td><input type="submit" value="Login" /></td>
                            <td><input type="reset" value="Reset" /></td>
                        </tr>
                    </tb>
                </table>
            </center>
                </form>
        <%
                session.setMaxInactiveInterval(2);
            if(application.getAttribute("counter") == null || (Integer)application.getAttribute("counter") == 0)
            {
                application.setAttribute("counter", 1);
            }
            if(session.isNew() == true)
            {
                synchronized(page)
                {
                    Integer counter = (Integer) application.getAttribute("counter");
                    counter += 1;
                    application.setAttribute("counter", counter);
                }
            }
        %>
        <p><b>User Counter:</b> <%=application.getAttribute("counter")%></p>
    
    
    </body>
</html>

Comments