From 32896e0cc3245b033d139c81dae0d76b9b23c6c1 Mon Sep 17 00:00:00 2001 From: Johannes Theiner Date: Fri, 17 May 2019 08:38:11 +0200 Subject: [PATCH] + dropdown with categories, not working fully Signed-off-by: Johannes Theiner --- pom.xml | 62 +++++++++---------- .../java/de/hsel/itech/jsf/CategoryBean.java | 21 ++++--- src/main/webapp/category.xhtml | 19 ++++-- 3 files changed, 58 insertions(+), 44 deletions(-) diff --git a/pom.xml b/pom.xml index d9f38fa..ca9f27f 100644 --- a/pom.xml +++ b/pom.xml @@ -45,38 +45,38 @@ - - - - org.apache.tomcat.maven - tomcat7-maven-plugin - 2.2 - - https://tomcat.joethei.space/manager/text - TomcatServer - /itech - - - - org.apache.maven.plugins - maven-war-plugin - 3.1.0 - - false - - - - org.apache.maven.plugins - maven-compiler-plugin - 3.1 - - ${java.version} - ${java.version} - - - - + + + org.apache.tomcat.maven + tomcat7-maven-plugin + 2.2 + + https://tomcat.joethei.space/manager/text + TomcatServer + /itech + + + + org.apache.maven.plugins + maven-war-plugin + 3.1.0 + + false + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.1 + + ${java.version} + ${java.version} + + + + + diff --git a/src/main/java/de/hsel/itech/jsf/CategoryBean.java b/src/main/java/de/hsel/itech/jsf/CategoryBean.java index d97c985..7c9d444 100644 --- a/src/main/java/de/hsel/itech/jsf/CategoryBean.java +++ b/src/main/java/de/hsel/itech/jsf/CategoryBean.java @@ -1,29 +1,34 @@ package de.hsel.itech.jsf; import de.hsel.itech.db.Database; +import de.hsel.itech.db.pojo.Book; import de.hsel.itech.db.pojo.Category; -import javax.faces.bean.ApplicationScoped; import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; import java.io.Serializable; import java.util.List; @ManagedBean -@ApplicationScoped +@ViewScoped public class CategoryBean implements Serializable { - private String hello = "Hallo Welt"; + private Category category; + + public Category getCategory() { + return category; + } + + public void setCategory(Category category) { + this.category = category; - public String getHello() { - return hello; } public List getCategories() { return Database.getInstance().getCategories(); } - public String test() { - return ""; + public List getBooks() { + return Database.getInstance().getBooks(category); } - } \ No newline at end of file diff --git a/src/main/webapp/category.xhtml b/src/main/webapp/category.xhtml index 2fe7543..d63cde7 100644 --- a/src/main/webapp/category.xhtml +++ b/src/main/webapp/category.xhtml @@ -6,15 +6,24 @@ xmlns:ui="http://xmlns.jcp.org/jsf/facelets" xmlns:f="http://xmlns.jcp.org/jsf/core"> -Amazon light + Amazon light - - -
-
+ + + + + + + + + + + +
+
\ No newline at end of file