diff --git a/pom.xml b/pom.xml index 4ace804..81ce4a5 100644 --- a/pom.xml +++ b/pom.xml @@ -98,7 +98,7 @@ myfaces-impl 2.3.3 - + org.projectlombok @@ -125,6 +125,28 @@ 20180813 + + javax.xml.bind + jaxb-api + 2.2.11 + + + com.sun.xml.bind + jaxb-core + 2.2.11 + + + com.sun.xml.bind + jaxb-impl + 2.2.11 + + + javax.activation + activation + 1.1.1 + + + org.mariadb.jdbc mariadb-java-client diff --git a/src/main/java/de/hsel/itech/jsf/BookInfo.java b/src/main/java/de/hsel/itech/jsf/BookBean.java similarity index 70% rename from src/main/java/de/hsel/itech/jsf/BookInfo.java rename to src/main/java/de/hsel/itech/jsf/BookBean.java index b29cf27..8a574bb 100644 --- a/src/main/java/de/hsel/itech/jsf/BookInfo.java +++ b/src/main/java/de/hsel/itech/jsf/BookBean.java @@ -1,30 +1,28 @@ package de.hsel.itech.jsf; -import de.hsel.itech.db.Database; import de.hsel.itech.db.pojo.Author; import de.hsel.itech.db.pojo.Book; +import lombok.Getter; +import lombok.Setter; import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; import javax.faces.bean.ViewScoped; import java.util.ArrayList; import java.util.List; -//JSF Bean for bookinfo -@ManagedBean(name="bookInfo") +@ManagedBean @ViewScoped -public class BookInfo { +public class BookBean { + + @Getter + @Setter + @ManagedProperty("#{categoryBean.book}") private Book book; - public BookInfo(){ - book = Database.getInstance().getBooks().get(2); - } + public String select() { - public Book getBook(){ - return book; - } - - public void setBook(Book book){ - this.book = book; + return "/bookinfo.jsf"; } public String getPrice(){ diff --git a/src/main/java/de/hsel/itech/jsf/CategoryBean.java b/src/main/java/de/hsel/itech/jsf/CategoryBean.java index 7c9d444..325fbf8 100644 --- a/src/main/java/de/hsel/itech/jsf/CategoryBean.java +++ b/src/main/java/de/hsel/itech/jsf/CategoryBean.java @@ -3,6 +3,8 @@ 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 lombok.Getter; +import lombok.Setter; import javax.faces.bean.ManagedBean; import javax.faces.bean.ViewScoped; @@ -13,15 +15,21 @@ import java.util.List; @ViewScoped public class CategoryBean implements Serializable { + @Getter + @Setter private Category category; - public Category getCategory() { - return category; + @Getter + @Setter + private Book book; + + public String select() { + return ""; } - public void setCategory(Category category) { - this.category = category; - + public String back() { + category = null; + return ""; } public List getCategories() { diff --git a/src/main/webapp/category.xhtml b/src/main/webapp/category.xhtml index 42dd909..b220064 100644 --- a/src/main/webapp/category.xhtml +++ b/src/main/webapp/category.xhtml @@ -5,23 +5,59 @@ xmlns:h="http://xmlns.jcp.org/jsf/html" xmlns:ui="http://xmlns.jcp.org/jsf/facelets" xmlns:f="http://xmlns.jcp.org/jsf/core"> - - Amazon light - + - + + + + + + + +

Kategorien

+ +
+ +
+ + +
+ #{category.name} +
+
+
+
+
+
+ + +

#{categoryBean.category.name}

+ + + +
+ +
+ + +
+ #{book.title} +
+
+
+
+ +
+ +
+
- -
-
+
+
- - - -
-
-
+
\ No newline at end of file diff --git a/src/main/webapp/template.xhtml b/src/main/webapp/template.xhtml index af9e554..387b93e 100644 --- a/src/main/webapp/template.xhtml +++ b/src/main/webapp/template.xhtml @@ -74,7 +74,9 @@ - +
+ +