Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
- <%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql"%>
- <%--
- Document : index
- Created on : 2015-10-30, 18:23:32
- Author : kamil
- --%>
- <%@page contentType="text/html" pageEncoding="UTF-8"%>
- <!DOCTYPE html>
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
- <link rel="Stylesheet" type="text/css" href="style.css" />
- <link href="css/bootstrap.min.css" rel="stylesheet">
- <script src="js/bootstrap.min.js"></script>
- <script src="js/jquery-2.1.4.min.js"></script>
- <title>JSP</title>
- </head>
- <body>
- <% if(request.getParameter("wyl") != null) session.removeAttribute("wynik"); %>
- <sql:setDataSource var="Polaczenie" driver="com.mysql.jdbc.Driver"
- url="jdbc:mysql://localhost/mydb"
- user="root" password=""/>
- <div id="logowanie">
- <form action="index.jsp" method="POST">
- <input type="text" name="login" size="15" placeholder="Login" class="form-control"><br>
- <input type="password" name="haslo" size="15" placeholder="Hasło" class="form-control"><br>
- <input type="submit" value="Zaloguj" class="btn btn-default" >
- <c:if test="${param.Login != null}">
- <sql:query dataSource="${Polaczenie}" var="wynik" scope="session">
- SELECT idUzytkownicy, Login, Haslo, ID_uprawnien, ID_adresu from uzytkownicy where Login = ? and Haslo = ?;
- <sql:param value="${param.Login}"/>
- <sql:param value="${param.Haslo}"/>
- </sql:query>
- <c:choose>
- <c:when test="${wynik.getRowCount() > 0}">
- <% response.sendRedirect("menu.jsp"); %>
- </c:when>
- <c:otherwise>
- <div id="bladlogowania">Błędny login lub hasło !</div>
- <%session.removeAttribute("wynik"); %>
- </c:otherwise>
- </c:choose>
- </c:if>
- </form>
- </div>
- </body>
- </html>
Add Comment
Please, Sign In to add comment