blob: 3c16a2831492454e88e1d8ded575e3f73040456c (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
|
<%@page import="models.User"%>
<%@page import="models.Monster"%>
<%@page import="java.util.ArrayList"%>
<%@page import="models.CONSTS"%>
<%@page import="java.rmi.Naming"%>
<%@page import="pokemon.IService"%>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html>
<html>
<head>
<meta charset="ISO-8859-1">
<title>Admin</title>
<style>
table, th, td {
border: 1px solid black;
border-collapse: collapse;
padding:2px;
}
</style>
</head>
<body>
<h1>Lista korisnika</h1>
<%
IService service=(IService)Naming.lookup(CONSTS.rmiUrl);
ArrayList<User>users=service.getAllUsers();
request.setAttribute("users", users);
%>
<table>
<tr>
<th>Id</th>
<th>Username</th>
<th>admin</th>
<th>pokemonId</th>
<th></th>
</tr>
<c:forEach items="${users}" var="item">
<tr>
<td>
<c:out value="${item.id}"/>
</td>
<td>
<c:out value="${item.username}"/>
</td>
<td>
<c:out value="${item.admin}"/>
</td>
<td>
<c:if test="${item.monsterId!=-1}">
<c:out value="${item.monsterId}"/>
</c:if>
</td>
<td>
<c:if test="${!item.admin}">
<a href="deleteUser.jsp?userId=${item.id}">
<button>Izbrisi</button>
</a>
</c:if>
</td>
</tr>
</c:forEach>
</table>
<br><br>
<h1>Registracija novog admina</h1>
<form method="post" action="registerAdmin.jsp">
<input type="text" name="username"> Korisnicko ime
<br>
<input type="password" name="password">Sifra
<br>
<p style="color:red;">
<%
if(request.getParameter("id")!=null &&request.getParameter("id").equals("-1") )
out.print("Username vec postoji");
%>
</p>
<p style="color:green;">
<%
if(request.getParameter("id")!=null &&request.getParameter("id").equals("-2") )
out.print("Uspesna registracija");
%>
</p>
<button type="submit">Registruj admina</button>
</form>
<h1>
</h1>
</body>
</html>
|