aboutsummaryrefslogtreecommitdiff
path: root/src/main/webapp/pages/adminIndex.jsp
diff options
context:
space:
mode:
authorOgnjen Cirkovic <ciraboxkg@gmail.com>2022-12-22 04:22:48 +0100
committerOgnjen Cirkovic <ciraboxkg@gmail.com>2022-12-22 04:22:48 +0100
commit92eab92efb1158b94fd6ce283a92191656649b85 (patch)
treec587bb3cd8e81e7b6e215404a282baae60e57f09 /src/main/webapp/pages/adminIndex.jsp
parentda35da09c1dfb1069d217fb730c098ef457513ad (diff)
Dodate provere role korisnika. Dodat prikaz pokemona kod admina.
Diffstat (limited to 'src/main/webapp/pages/adminIndex.jsp')
-rw-r--r--src/main/webapp/pages/adminIndex.jsp46
1 files changed, 46 insertions, 0 deletions
diff --git a/src/main/webapp/pages/adminIndex.jsp b/src/main/webapp/pages/adminIndex.jsp
index 1b0f4e7..25d021f 100644
--- a/src/main/webapp/pages/adminIndex.jsp
+++ b/src/main/webapp/pages/adminIndex.jsp
@@ -21,14 +21,26 @@
</style>
</head>
<body>
+<%
+boolean isAdmin=(Boolean)session.getAttribute("admin");
+if(!isAdmin){
+ response.sendRedirect("../index.jsp");
+}
+%>
<a href="logout.jsp">
<button>Log out</button>
+</a><br><br>
+<a href="addNewPokemon.jsp">
+ <button>DodajNovogPokemona</button>
</a>
+
<h1>Lista korisnika</h1>
<%
IService service=(IService)Naming.lookup(CONSTS.rmiUrl);
ArrayList<User>users=service.getAllUsers();
request.setAttribute("users", users);
+ArrayList<Monster> monsters=service.getMonsters();
+request.setAttribute("monsters", monsters);
%>
@@ -95,6 +107,40 @@ request.setAttribute("users", users);
</h1>
+<h1>Svi pokemoni</h1>
+<table>
+<tr>
+<th>Ime</th>
+<th>Opis</th>
+<th>Hp</th>
+<th>Slika</th>
+<th></th>
+</tr>
+<c:forEach items="${monsters}" var="item">
+<tr>
+ <td>
+ <c:out value="${item.name}"/>
+ </td>
+ <td>
+ <c:out value="${item.description}"/>
+ </td>
+ <td>
+ <c:out value="${item.hp}"/>
+ </td>
+ <td>
+ <img style="height: 50px" src="data:image/*;base64, ${item.base64Image }" />
+ </td>
+ <td>
+ <a href="deletePokemon.jsp?monsterId=${item.id}">
+ <button>Izbrisi</button>
+</a>
+ </td>
+</tr>
+</c:forEach>
+
+</table>
+
+
</body>