]> git.mxchange.org Git - pizzaservice-war.git/commitdiff
Initial stuff for Java Server Faces added
authorRoland Haeder <roland@mxchange.org>
Mon, 24 Aug 2015 09:24:50 +0000 (11:24 +0200)
committerRoland Haeder <roland@mxchange.org>
Mon, 24 Aug 2015 09:24:50 +0000 (11:24 +0200)
Signed-off-by:Roland Häder <roland@mxchange.org>

nbproject/project.properties
web/WEB-INF/web.xml
web/index.xhtml [new file with mode: 0644]

index d63eef99e4bc5c169ed9733ceb026e672223b835..331c22de8886accd8c67e5ea09dfcd3cf149f931 100644 (file)
@@ -3,6 +3,7 @@ annotation.processing.enabled.in.editor=true
 annotation.processing.processors.list=
 annotation.processing.run.all.processors=true
 annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
+auxiliary.org-netbeans-modules-projectapi.jsf_2e_language=Facelets
 build.classes.dir=${build.web.dir}/WEB-INF/classes
 build.classes.excludes=**/*.java,**/*.form
 build.dir=build
@@ -36,11 +37,11 @@ j2ee.compile.on.save=true
 j2ee.copy.static.files.on.save=true
 j2ee.deploy.on.save=true
 j2ee.platform=1.5
-j2ee.platform.classpath=${j2ee.server.middleware}/mq/lib/jaxm-api.jar:${j2ee.server.home}/modules/endorsed/javax.annotation-api.jar:${j2ee.server.home}/modules/endorsed/webservices-api-osgi.jar:${j2ee.server.home}/modules/endorsed/jaxb-api.jar:${j2ee.server.home}/modules/javax.batch-api.jar:${j2ee.server.home}/modules/javax.security.auth.message-api.jar:${j2ee.server.home}/modules/javax.faces.jar:${j2ee.server.home}/modules/javax.servlet.jsp.jstl-api.jar:${j2ee.server.home}/modules/javax.transaction-api.jar:${j2ee.server.home}/modules/javax.servlet.jsp.jar:${j2ee.server.home}/modules/webservices-osgi.jar:${j2ee.server.home}/modules/javax.mail.jar:${j2ee.server.home}/modules/javax.interceptor-api.jar:${j2ee.server.home}/modules/javax.inject.jar:${j2ee.server.home}/modules/javax.resource-api.jar:${j2ee.server.home}/modules/javax.enterprise.concurrent-api.jar:${j2ee.server.home}/modules/javax.el.jar:${j2ee.server.home}/modules/javax.ejb-api.jar:${j2ee.server.home}/modules/javax.xml.rpc-api.jar:${j2ee.server.home}/modules/javax.security.jacc-api.jar:${j2ee.server.home}/modules/javax.json.jar:${j2ee.server.home}/modules/javax.xml.registry-api.jar:${j2ee.server.home}/modules/javax.websocket-api.jar:${j2ee.server.home}/modules/javax.management.j2ee-api.jar:${j2ee.server.home}/modules/javax.servlet-api.jar:${j2ee.server.home}/modules/javax.jms-api.jar:${j2ee.server.home}/modules/javax.enterprise.concurrent.jar:${j2ee.server.home}/modules/javax.servlet.jsp.jstl.jar:${j2ee.server.home}/modules/javax.enterprise.deploy-api.jar:${j2ee.server.home}/modules/bean-validator.jar:${j2ee.server.home}/modules/javax.ws.rs-api.jar:${j2ee.server.home}/modules/javax.servlet.jsp-api.jar:${j2ee.server.home}/modules/jaxb-osgi.jar:${j2ee.server.home}/modules/weld-osgi-bundle.jar:${j2ee.server.home}/modules/javax.persistence.jar
+j2ee.platform.classpath=${j2ee.server.middleware}/mq/lib/jaxm-api.jar:${j2ee.server.home}/modules/endorsed/javax.annotation-api.jar:${j2ee.server.home}/modules/endorsed/jaxb-api-osgi.jar:${j2ee.server.home}/modules/endorsed/webservices-api-osgi.jar:${j2ee.server.home}/modules/bean-validator.jar:${j2ee.server.home}/modules/javax.batch-api.jar:${j2ee.server.home}/modules/javax.ejb-api.jar:${j2ee.server.home}/modules/javax.el.jar:${j2ee.server.home}/modules/javax.enterprise.concurrent-api.jar:${j2ee.server.home}/modules/javax.enterprise.concurrent.jar:${j2ee.server.home}/modules/javax.enterprise.deploy-api.jar:${j2ee.server.home}/modules/javax.faces.jar:${j2ee.server.home}/modules/javax.inject.jar:${j2ee.server.home}/modules/javax.interceptor-api.jar:${j2ee.server.home}/modules/javax.jms-api.jar:${j2ee.server.home}/modules/javax.json.jar:${j2ee.server.home}/modules/javax.mail.jar:${j2ee.server.home}/modules/javax.management.j2ee-api.jar:${j2ee.server.home}/modules/javax.persistence.jar:${j2ee.server.home}/modules/javax.resource-api.jar:${j2ee.server.home}/modules/javax.security.auth.message-api.jar:${j2ee.server.home}/modules/javax.security.jacc-api.jar:${j2ee.server.home}/modules/javax.servlet-api.jar:${j2ee.server.home}/modules/javax.servlet.jsp-api.jar:${j2ee.server.home}/modules/javax.servlet.jsp.jar:${j2ee.server.home}/modules/javax.servlet.jsp.jstl-api.jar:${j2ee.server.home}/modules/javax.servlet.jsp.jstl.jar:${j2ee.server.home}/modules/javax.transaction-api.jar:${j2ee.server.home}/modules/javax.websocket-api.jar:${j2ee.server.home}/modules/javax.ws.rs-api.jar:${j2ee.server.home}/modules/javax.xml.registry-api.jar:${j2ee.server.home}/modules/javax.xml.rpc-api.jar:${j2ee.server.home}/modules/jaxb-osgi.jar:${j2ee.server.home}/modules/webservices-osgi.jar:${j2ee.server.home}/modules/weld-osgi-bundle.jar
 j2ee.platform.embeddableejb.classpath=${j2ee.server.home}/lib/embedded/glassfish-embedded-static-shell.jar
 j2ee.platform.wscompile.classpath=${j2ee.server.home}/modules/webservices-osgi.jar
-j2ee.platform.wsgen.classpath=${j2ee.server.home}/modules/webservices-osgi.jar:${j2ee.server.home}/modules/endorsed/webservices-api-osgi.jar:${j2ee.server.home}/modules/jaxb-osgi.jar:${j2ee.server.home}/modules/endorsed/jaxb-api.jar
-j2ee.platform.wsimport.classpath=${j2ee.server.home}/modules/webservices-osgi.jar:${j2ee.server.home}/modules/endorsed/webservices-api-osgi.jar:${j2ee.server.home}/modules/jaxb-osgi.jar:${j2ee.server.home}/modules/endorsed/jaxb-api.jar
+j2ee.platform.wsgen.classpath=${j2ee.server.home}/modules/webservices-osgi.jar:${j2ee.server.home}/modules/endorsed/webservices-api-osgi.jar:${j2ee.server.home}/modules/jaxb-osgi.jar:${j2ee.server.home}/modules/endorsed/jaxb-api-osgi.jar
+j2ee.platform.wsimport.classpath=${j2ee.server.home}/modules/webservices-osgi.jar:${j2ee.server.home}/modules/endorsed/webservices-api-osgi.jar:${j2ee.server.home}/modules/jaxb-osgi.jar:${j2ee.server.home}/modules/endorsed/jaxb-api-osgi.jar
 j2ee.platform.wsit.classpath=
 j2ee.server.type=gfv3ee6
 jar.compress=false
index 78c62db097cb394c560c99d4c02363d4c93ae20a..6aa9fd3047c46b422bf4256abe4de9ebf130d64a 100644 (file)
         <param-name>database.backend.storagepath</param-name>
         <param-value>data</param-value>
     </context-param>
+    <context-param>
+        <param-name>javax.faces.PROJECT_STAGE</param-name>
+        <param-value>Development</param-value>
+    </context-param>
     <filter>
         <description>A servlet filter for setting character encoding to UTF-8</description>
         <filter-name>Utf8ServletFilter</filter-name>
         <filter-name>Utf8ServletFilter</filter-name>
         <url-pattern>/*</url-pattern>
     </filter-mapping>
+    <servlet>
+        <servlet-name>Faces Servlet</servlet-name>
+        <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
+        <load-on-startup>1</load-on-startup>
+    </servlet>
+    <servlet-mapping>
+        <servlet-name>Faces Servlet</servlet-name>
+        <url-pattern>/faces/*</url-pattern>
+    </servlet-mapping>
     <session-config>
         <session-timeout>
             30
         </session-timeout>
     </session-config>
     <welcome-file-list>
+        <!--<welcome-file>faces/index.xhtml</welcome-file>-->
         <welcome-file>index.jsp</welcome-file>
     </welcome-file-list>
 </web-app>
diff --git a/web/index.xhtml b/web/index.xhtml
new file mode 100644 (file)
index 0000000..bf2e0c5
--- /dev/null
@@ -0,0 +1,98 @@
+<?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="http://www.w3.org/1999/xhtml" xmlns:h="http://xmlns.jcp.org/jsf/html"
+         xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
+         xmlns:f="http://xmlns.jcp.org/jsf/core">
+       <ui:param name="path" value="#{request.contextPath}" />
+       <h:head>
+               <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+               <link rel="stylesheet" href="#{path}/style.css" type="text/css"/>
+               <title>Willkommen</title>
+       </h:head>
+       <h:body>
+               <div id="header"> 
+                       <div id="title">
+                               <h1>Willkommen</h1>
+                       </div>
+               </div>
+
+               <ui:include src="/static/guest/guest_menu.xhtml" id="menu" />
+
+               <div id="content_outer">
+                       <div id="content_title">
+                               <h2>Folgendes kann bestellt werden:</h2>
+                       </div>
+
+                       <div id="content">
+                               <h:panelGrid class="table" columns="4">
+                                       <h:column class="table_header_column">Bestellen?</h:column>
+                                       <h:column class="table_header_column">Anzahl:</h:column>
+                                       <h:column class="table_header_column">Produkt:</h:column>
+                                       <h:column class="table_header_column">Einzelpreis:</h:column>
+                               </h:panelGrid>
+
+                               <%
+                               // Get app instance
+                               PizzaApplication app = PizzaServiceApplication.getInstance(application);
+
+                               // Get Iterator
+                               Iterator<Product> iterator = app.getAvailableProducts();
+
+                               // "Walk" through all products and unmark them as ordered
+                               while (iterator.hasNext()) {
+                                       // Get product instance
+                                       Product product = iterator.next();
+
+                                       // Get basket instance
+                                       Basket<AddableBasketItem> basket = ItemBasket.getInstance(session);
+
+                                       // Create an item instance form this product
+                                       AddableBasketItem item = basket.getItem(product);
+
+                                       // Has it been already added to the basket?
+                                       if (item != null) {
+                                               // Some nice output ...
+                                               %>
+                               <h:panelGrid class="table" columns="4">
+                                       <h:column class="table_header_column"><a href="#{path}/basket.jsp" title="Zum Warenkorb">Warenkorb</a></h:column>
+                                       <h:column class="table_header_column"><%=item.getAmount()%></h:column>
+                                       <h:column class="table_header_column"><%=product.getTitle()%></h:column>
+                                       <h:column class="table_header_column"><f:convertNumber type="currency"><%=product.getPrice()%></f:convertNumber></h:column>
+                               </h:panelGrid>
+                                               <%
+                                               // Then skip this item
+                                               continue;
+                                       }
+
+                                       // Unmark as ordered
+                                       app.unmarkProductAsOrdered(product, session);
+                                       %>
+                               <h:form>
+                               <h:panelGrid class="table" columns="4">
+                                       <h:column class="table_header_column">
+                                               <h:commandButton action="#{path}/form_handler/add_item.jsp" class="submit" value="Hinzuf&uuml;gen" />
+                                               <input class="input" type="hidden" name="<%=PizzaApplication.HTTP_PARAM_ITEM_ID%>" value="<%=product.getId()%>" />
+                                               <input class="input" type="hidden" name="<%=PizzaApplication.HTTP_PARAM_ITEM_TYPE%>" value="Product" />
+                                       </h:column>
+                                       <h:column class="table_header_column">
+                                               <!--<h:inputText class="input" size="3" maxlength="20" />-->
+                                               <input class="input" type="text" name="<%=PizzaApplication.HTTP_PARAM_AMOUNT%>" size="3" maxlength="20" />
+                                       </h:column>
+                                       <h:column class="table_header_column">
+                                               <%=product.getTitle()%>
+                                       </h:column>
+                                       <h:column class="table_header_column right">
+                                               <f:convertNumber type="currency"><%=product.getPrice()%></f:convertNumber>
+                                       </h:column>
+                               </h:panelGrid>
+                               </h:form>
+                               <%
+                       }
+                       %>
+                       </div>
+               </div>
+
+               <ui:include src="/static/guest/guest_footer.xhtml" id="footer" />
+
+       </h:body>
+</html>