tried finding bug
This commit is contained in:
parent
7172524501
commit
b231574e76
5
pom.xml
5
pom.xml
@ -245,6 +245,11 @@
|
||||
<artifactId>myfaces-impl</artifactId>
|
||||
<version>2.3.3</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.myfaces.tomahawk</groupId>
|
||||
<artifactId>tomahawk20</artifactId>
|
||||
<version>1.1.14</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
|
||||
|
@ -2,6 +2,8 @@ package de.hsel.itech.db.pojo;
|
||||
|
||||
import lombok.*;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* POJO for Category.
|
||||
*
|
||||
@ -14,7 +16,7 @@ import lombok.*;
|
||||
@AllArgsConstructor
|
||||
@RequiredArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class Category {
|
||||
public class Category implements Serializable {
|
||||
|
||||
private long id;
|
||||
@NonNull private String name;
|
||||
|
26
src/main/java/de/hsel/itech/jsf/CategoryBean.java
Normal file
26
src/main/java/de/hsel/itech/jsf/CategoryBean.java
Normal file
@ -0,0 +1,26 @@
|
||||
package de.hsel.itech.jsf;
|
||||
|
||||
import de.hsel.itech.db.Database;
|
||||
import de.hsel.itech.db.pojo.Category;
|
||||
|
||||
import javax.faces.bean.ApplicationScoped;
|
||||
import javax.faces.bean.ManagedBean;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@ManagedBean
|
||||
@ApplicationScoped
|
||||
public class CategoryBean implements Serializable {
|
||||
|
||||
|
||||
private String hello = "Hallo Welt";
|
||||
|
||||
public String getHello() {
|
||||
return hello;
|
||||
}
|
||||
|
||||
public List<Category> getCategories() {
|
||||
return Database.getInstance().getCategories();
|
||||
}
|
||||
|
||||
}
|
30
src/main/webapp/WEB-INF/web.xml
Normal file
30
src/main/webapp/WEB-INF/web.xml
Normal file
@ -0,0 +1,30 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns="http://java.sun.com/xml/ns/javaee"
|
||||
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
|
||||
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
|
||||
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
|
||||
id="itech" version="2.5">
|
||||
|
||||
<display-name>Amazon light</display-name>
|
||||
|
||||
<!-- Change to "Production" when you are ready to deploy -->
|
||||
<context-param>
|
||||
<param-name>javax.faces.PROJECT_STAGE</param-name>
|
||||
<param-value>Development</param-value>
|
||||
</context-param>
|
||||
|
||||
<!-- JSF mapping -->
|
||||
<servlet>
|
||||
<servlet-name>Faces Servlet</servlet-name>
|
||||
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
|
||||
<load-on-startup>1</load-on-startup>
|
||||
</servlet>
|
||||
|
||||
<!-- Map these files with JSF -->
|
||||
<servlet-mapping>
|
||||
<servlet-name>Faces Servlet</servlet-name>
|
||||
<url-pattern>*.jsf</url-pattern>
|
||||
</servlet-mapping>
|
||||
|
||||
</web-app>
|
30
src/main/webapp/category.xhtml
Normal file
30
src/main/webapp/category.xhtml
Normal file
@ -0,0 +1,30 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html
|
||||
xmlns:h="http://xmlns.jcp.org/jsf/html"
|
||||
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
|
||||
xmlns:f="http://xmlns.jcp.org/jsf/core">
|
||||
<head>
|
||||
<title>ha</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h:outputText value="#{categoryBean.hello}"/>
|
||||
|
||||
<h:outputText value="null " rendered="#{empty categoryBean}"/>
|
||||
<h:outputText value="Table is empty!" rendered="#{empty categoryBean.categories}"/>
|
||||
<h:outputText value="#{categoryBean.hello}"/>
|
||||
<h:dataTable var="category" value="#{categoryBean.categories}">
|
||||
<h:column>
|
||||
<h:outputText value="#{category.name}"/>
|
||||
</h:column>
|
||||
</h:dataTable>
|
||||
|
||||
<ui:repeat value="#{categoryBean.categories}" var="category">
|
||||
<h:outputText value="Hallo Welt"/>
|
||||
<h:outputText value="#{category.name}"/>
|
||||
</ui:repeat>
|
||||
</body>
|
||||
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user