From 28ae1223cdf7551aada45365c104c363fdf18b55 Mon Sep 17 00:00:00 2001 From: Carlos Eduardo da Silva <kaduardo@imd.ufrn.br> Date: Thu, 1 Oct 2015 17:23:29 -0300 Subject: [PATCH] Saving the rest --- Calculator-Bean/.classpath | 1 + .../WEB-INF/.faces-config.xml.jsfdia | 13 +++++++++++++ .../WebContent/WEB-INF/faces-config.xml | 17 ++++++++++++++--- Calculator-Web/WebContent/formulario.xhtml | 19 +++++++++++++++++++ Calculator-Web/WebContent/index.html | 12 ++++++++++++ Calculator-Web/WebContent/resultado.xhtml | 18 ++++++++++++++++++ README.md | 4 ++++ 7 files changed, 81 insertions(+), 3 deletions(-) create mode 100644 Calculator-Web/WebContent/WEB-INF/.faces-config.xml.jsfdia create mode 100644 Calculator-Web/WebContent/formulario.xhtml create mode 100644 Calculator-Web/WebContent/index.html create mode 100644 Calculator-Web/WebContent/resultado.xhtml diff --git a/Calculator-Bean/.classpath b/Calculator-Bean/.classpath index 218b82a..98ce604 100644 --- a/Calculator-Bean/.classpath +++ b/Calculator-Bean/.classpath @@ -12,5 +12,6 @@ </attributes> </classpathentry> <classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/> + <classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/> <classpathentry kind="output" path="build/classes"/> </classpath> diff --git a/Calculator-Web/WebContent/WEB-INF/.faces-config.xml.jsfdia b/Calculator-Web/WebContent/WEB-INF/.faces-config.xml.jsfdia new file mode 100644 index 0000000..3d873e5 --- /dev/null +++ b/Calculator-Web/WebContent/WEB-INF/.faces-config.xml.jsfdia @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="UTF-8"?> +<PROCESS model-entity="JSFProcess"> + <PROCESS-ITEM NAME="rules:#formulario.xhtml" PATH="/formulario.xhtml" + SHAPE="259,164,0,0" model-entity="JSFProcessGroup"> + <PROCESS-ITEM ID="rules:#formulario.xhtml:0" NAME="item" + PATH="/formulario.xhtml" model-entity="JSFProcessItem"> + <PROCESS-ITEM-OUTPUT ID="Soma::#resultado.xhtml" NAME="output" + PATH="/resultado.xhtml" TARGET="rules:#resultado.xhtml" TITLE="Soma" model-entity="JSFProcessItemOutput"/> + </PROCESS-ITEM> + </PROCESS-ITEM> + <PROCESS-ITEM NAME="rules:#resultado.xhtml" PATH="/resultado.xhtml" + SHAPE="272,360,50,25" model-entity="JSFProcessGroup" persistent="true"/> +</PROCESS> diff --git a/Calculator-Web/WebContent/WEB-INF/faces-config.xml b/Calculator-Web/WebContent/WEB-INF/faces-config.xml index cd6bf62..74bb67c 100644 --- a/Calculator-Web/WebContent/WEB-INF/faces-config.xml +++ b/Calculator-Web/WebContent/WEB-INF/faces-config.xml @@ -1,6 +1,17 @@ <?xml version="1.0" encoding="UTF-8"?> - <faces-config version="2.2" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-facesconfig_2_2.xsd"> - -</faces-config> \ No newline at end of file + <managed-bean> + <managed-bean-name>calculatorManagedBean</managed-bean-name> + <managed-bean-class>br.ufrn.imd.imd0409.calculator.view.CalculatorManagedBean</managed-bean-class> + <managed-bean-scope>request</managed-bean-scope> + </managed-bean> + <navigation-rule> + <from-view-id>/formulario.xhtml</from-view-id> + <navigation-case> + <from-outcome>Soma</from-outcome> + <to-view-id>/resultado.xhtml</to-view-id> + </navigation-case> + </navigation-rule> + <application/> +</faces-config> diff --git a/Calculator-Web/WebContent/formulario.xhtml b/Calculator-Web/WebContent/formulario.xhtml new file mode 100644 index 0000000..347cfb1 --- /dev/null +++ b/Calculator-Web/WebContent/formulario.xhtml @@ -0,0 +1,19 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" + xmlns:ui="http://java.sun.com/jsf/facelets" + xmlns:f="http://java.sun.com/jsf/core" + xmlns:h="http://java.sun.com/jsf/html"> + +<h:head>Testing Calculator Bean from JSF</h:head> +<body> + <h:form> + <h:panelGrid border="1" columns="2"> + <h:outputText value="Primeiro numero"></h:outputText> + <h:inputText value="#{calculatorManagedBean.numero1}" /> + <h:outputText value="Segundo numero"></h:outputText> + <h:inputText value="#{calculatorManagedBean.numero2}"/> + </h:panelGrid> + <h:commandButton value="Soma" action="#{calculatorManagedBean.calcula}"/> + </h:form> +</body> +</html> diff --git a/Calculator-Web/WebContent/index.html b/Calculator-Web/WebContent/index.html new file mode 100644 index 0000000..cdb9323 --- /dev/null +++ b/Calculator-Web/WebContent/index.html @@ -0,0 +1,12 @@ +<!DOCTYPE html> +<html> +<head> +<meta charset="UTF-8"> +<title>My First EJB</title> +</head> +<body> +<a href="faces/formulario.xhtml">Exemplo com JSF</a><br> +<a href="formulario.html">Exemplo com Servlet</a> + +</body> +</html> \ No newline at end of file diff --git a/Calculator-Web/WebContent/resultado.xhtml b/Calculator-Web/WebContent/resultado.xhtml new file mode 100644 index 0000000..f644069 --- /dev/null +++ b/Calculator-Web/WebContent/resultado.xhtml @@ -0,0 +1,18 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" + xmlns:ui="http://java.sun.com/jsf/facelets" + xmlns:f="http://java.sun.com/jsf/core" + xmlns:h="http://java.sun.com/jsf/html"> + +<h:head>O resultado</h:head> +<body> + <h:panelGrid border="1" columns="2"> + <h:outputLabel value="Numero 1"/> + <h:outputText value="#{calculatorManagedBean.numero1}"/> + <h:outputLabel value="Numero 2"/> + <h:outputText value="#{calculatorManagedBean.numero2}"/> + <h:outputLabel value="Resultado"></h:outputLabel> + <h:outputText value="#{calculatorManagedBean.resultado}"/> + </h:panelGrid> +</body> +</html> diff --git a/README.md b/README.md index 0ba8a1d..b2ce40f 100644 --- a/README.md +++ b/README.md @@ -1 +1,5 @@ # MyFirstEJB-Calculator + +Implementation of the Calculator Bean example from the Book +Enterprise JavaBeans 3.1, 6th Edition +By Andrew Lee Rubinger, Bill Burke -- GitLab