diff options
Diffstat (limited to 'src/main/webapp')
-rw-r--r-- | src/main/webapp/pages/addNewPokemon.jsp | 49 | ||||
-rw-r--r-- | src/main/webapp/pages/addNewPokemonHelper.jsp | 46 | ||||
-rw-r--r-- | src/main/webapp/pages/adminIndex.jsp | 3 |
3 files changed, 98 insertions, 0 deletions
diff --git a/src/main/webapp/pages/addNewPokemon.jsp b/src/main/webapp/pages/addNewPokemon.jsp new file mode 100644 index 0000000..201370b --- /dev/null +++ b/src/main/webapp/pages/addNewPokemon.jsp @@ -0,0 +1,49 @@ +<%@ page language="java" contentType="text/html; charset=ISO-8859-1" + pageEncoding="ISO-8859-1"%> +<!DOCTYPE html> +<html> +<head> +<meta charset="ISO-8859-1"> +<title>Insert title here</title> +</head> +<body> + + + +<form method="post" action="addNewPokemonHelper.jsp"> +<input type="text" name="name"> Ime <br> +<input type="text" name="description"> Opis <br> +<input type="text" name="hp"> Hp <br> +<input type="text" name="base64Image"> ImageString64 <br> + +<h2>Abilities</h2> +<h3>ATTACK</h3> +<input type="text" name="abilitiesName"> Ime <br> +<input type="text" name="abilitiesDesc"> Opis <br> +<input type="hidden" name="abilitiesType" value="0"> +<input type="text" name="abilitiesPower"> Snaga <br> +<h3>SPECIAL</h3> +<input type="text" name="abilitiesName"> Ime <br> +<input type="text" name="abilitiesDesc"> Opis <br> +<input type="hidden" name="abilitiesType" value="1"> +<input type="text" name="abilitiesPower"> Snaga <br> +<h3>HEAL</h3> +<input type="text" name="abilitiesName"> Ime <br> +<input type="text" name="abilitiesDesc"> Opis <br> +<input type="hidden" name="abilitiesType" value="2"> +<input type="text" name="abilitiesPower"> Snaga <br> +<h3>SHIELD</h3> +<input type="text" name="abilitiesName"> Ime <br> +<input type="text" name="abilitiesDesc"> Opis <br> +<input type="hidden" name="abilitiesType" value="3"> +<input type="text" name="abilitiesPower"> Snaga <br> + +<button type="submit">Dodaj</button> + + + +</form> + + +</body> +</html>
\ No newline at end of file diff --git a/src/main/webapp/pages/addNewPokemonHelper.jsp b/src/main/webapp/pages/addNewPokemonHelper.jsp new file mode 100644 index 0000000..2553bb9 --- /dev/null +++ b/src/main/webapp/pages/addNewPokemonHelper.jsp @@ -0,0 +1,46 @@ +<%@page import="models.AbilityType"%> +<%@page import="models.Ability"%> +<%@page import="java.util.List"%> +<%@page import="java.util.Arrays"%> +<%@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"%> +<!DOCTYPE html> +<html> +<head> +<meta charset="ISO-8859-1"> +<title>Insert title here</title> +</head> +<body> +<jsp:useBean id="pokemon" class="models.PokemonAddModel"></jsp:useBean> + +<jsp:setProperty property="*" name="pokemon"/> +<% +IService service=(IService)Naming.lookup(CONSTS.rmiUrl); +List<String> names=Arrays.asList(request.getParameterValues("abilitiesName")); +List<String> desc=Arrays.asList(request.getParameterValues("abilitiesDesc")); +List<String> type=Arrays.asList(request.getParameterValues("abilitiesType")); +List<String> power=Arrays.asList(request.getParameterValues("abilitiesPower")); +pokemon.abilities=new ArrayList<Ability>(); + +for (int i = 0; i < 4; i++) { + Ability tempA=new Ability(); + tempA.setName(names.get(i)); + tempA.setDescription(desc.get(i)); + int tempType=Integer.parseInt(type.get(i)); + tempA.setType(AbilityType.values()[tempType]); + int tempPower=Integer.parseInt(power.get(i)); + tempA.setPower(tempPower); + pokemon.abilities.add(tempA); + } +service.addPokemonWithAbilities(pokemon); +response.sendRedirect("adminIndex.jsp"); + + +%> + +</body> +</html>
\ No newline at end of file diff --git a/src/main/webapp/pages/adminIndex.jsp b/src/main/webapp/pages/adminIndex.jsp index 3c16a28..1b0f4e7 100644 --- a/src/main/webapp/pages/adminIndex.jsp +++ b/src/main/webapp/pages/adminIndex.jsp @@ -21,6 +21,9 @@ </style> </head> <body> +<a href="logout.jsp"> + <button>Log out</button> +</a> <h1>Lista korisnika</h1> <% IService service=(IService)Naming.lookup(CONSTS.rmiUrl); |