Browse Source

Merge pull request #5 from jordanmason-stleo/master

Uh
pull/5/head
Gregory Rudolph 4 years ago committed by GitHub
parent
commit
deed9d35ec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      src/main/java/MTGClone/controller/CardController.java
  2. 2
      src/main/java/MTGClone/controller/HelloController.java
  3. 22
      src/main/webapp/WEB-INF/jsp/card.jsp

2
src/main/java/MTGClone/controller/CardController.java

@ -13,7 +13,7 @@ import java.util.ArrayList;
@Controller @Controller
public class CardController { public class CardController {
@GetMapping({"/card"}) @GetMapping({"/card", "/"})
public String hello(Model model) { public String hello(Model model) {
ArrayList<Card> allCards = (new SQLDriver()).getAllCards(); ArrayList<Card> allCards = (new SQLDriver()).getAllCards();
model.addAttribute("allcards", allCards); model.addAttribute("allcards", allCards);

2
src/main/java/MTGClone/controller/HelloController.java

@ -9,7 +9,7 @@ import org.springframework.web.bind.annotation.RequestParam;
@Controller @Controller
public class HelloController { public class HelloController {
@GetMapping({"/", "/hello"}) @GetMapping({"/hello"})
public String hello(Model model, @RequestParam(value="name", required=false, defaultValue="World") String name) { public String hello(Model model, @RequestParam(value="name", required=false, defaultValue="World") String name) {
model.addAttribute("name", name); model.addAttribute("name", name);
return "hello"; return "hello";

22
src/main/webapp/WEB-INF/jsp/card.jsp

@ -8,11 +8,18 @@
clear: both; clear: both;
} }
td, th{
padding: 5px 5px 5px 5px;
}
table, td, th{
border: 1px solid black;
border-collapse: collapse;
}
.container input { .container input {
width: 100%; width: 100%;
clear: both; clear: both;
} }
</style> </style>
<meta charset="UTF-8"> <meta charset="UTF-8">
@ -37,9 +44,11 @@
<input type="text" id="creaturetype" name="creaturetype"><br> <input type="text" id="creaturetype" name="creaturetype"><br>
<br> <input style="width:30%;display:block;margin:0 auto;" type="submit" value="Submit"> <br> <input style="width:30%;display:block;margin:0 auto;" type="submit" value="Submit">
</form> </form>
</div> </div>
<table style="width:100%"> <br>
<br>
<table style>
<tr> <tr>
<th>Card Name</th> <th>Card Name</th>
<th>Mana Cost</th> <th>Mana Cost</th>
@ -48,20 +57,23 @@
<th>Description</th> <th>Description</th>
<th>Creature Type</th> <th>Creature Type</th>
</tr> </tr>
<tr>
<c:if test="${not empty allcards}"> <c:if test="${not empty allcards}">
<c:forEach var="listValue" items="${allcards}"> <c:forEach var="listValue" items="${allcards}">
<tr></tr>
<td>${listValue.cardName}</td> <td>${listValue.cardName}</td>
<td>${listValue.manaCost}</td> <td>${listValue.manaCost}</td>
<td>${listValue.power}</td> <td>${listValue.power}</td>
<td>${listValue.toughness}</td> <td>${listValue.toughness}</td>
<td>${listValue.description}</td> <td>${listValue.description}</td>
<td>${listValue.creatureType}</td> <td>${listValue.creatureType}</td>
</tr>
</c:forEach> </c:forEach>
</c:if> </c:if>
</tr>
</table> </table>
</body> </body>
</html> </html>
Loading…
Cancel
Save