You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by ha...@apache.org on 2008/11/23 04:37:32 UTC

svn commit: r719948 - in /myfaces/commons/trunk/myfaces-commons-examples/src/main/webapp: WEB-INF/faces-config.xml exporter.jsp home.jsp

Author: hazems
Date: Sat Nov 22 19:37:32 2008
New Revision: 719948

URL: http://svn.apache.org/viewvc?rev=719948&view=rev
Log:
Adding exporter example to commons.

Added:
    myfaces/commons/trunk/myfaces-commons-examples/src/main/webapp/exporter.jsp
Modified:
    myfaces/commons/trunk/myfaces-commons-examples/src/main/webapp/WEB-INF/faces-config.xml
    myfaces/commons/trunk/myfaces-commons-examples/src/main/webapp/home.jsp

Modified: myfaces/commons/trunk/myfaces-commons-examples/src/main/webapp/WEB-INF/faces-config.xml
URL: http://svn.apache.org/viewvc/myfaces/commons/trunk/myfaces-commons-examples/src/main/webapp/WEB-INF/faces-config.xml?rev=719948&r1=719947&r2=719948&view=diff
==============================================================================
--- myfaces/commons/trunk/myfaces-commons-examples/src/main/webapp/WEB-INF/faces-config.xml (original)
+++ myfaces/commons/trunk/myfaces-commons-examples/src/main/webapp/WEB-INF/faces-config.xml Sat Nov 22 19:37:32 2008
@@ -18,4 +18,9 @@
         <managed-bean-class>org.apache.myfaces.examples.validate.ValidateEnum</managed-bean-class>
         <managed-bean-scope>request</managed-bean-scope>
     </managed-bean>
+    <managed-bean>
+    	<managed-bean-name>exporterBean</managed-bean-name>
+    	<managed-bean-class>org.apache.myfaces.commons.exporter.ExporterBean</managed-bean-class>
+    	<managed-bean-scope>request</managed-bean-scope>
+    </managed-bean>    
 </faces-config>

Added: myfaces/commons/trunk/myfaces-commons-examples/src/main/webapp/exporter.jsp
URL: http://svn.apache.org/viewvc/myfaces/commons/trunk/myfaces-commons-examples/src/main/webapp/exporter.jsp?rev=719948&view=auto
==============================================================================
--- myfaces/commons/trunk/myfaces-commons-examples/src/main/webapp/exporter.jsp (added)
+++ myfaces/commons/trunk/myfaces-commons-examples/src/main/webapp/exporter.jsp Sat Nov 22 19:37:32 2008
@@ -0,0 +1,92 @@
+<%@ page import="java.math.BigDecimal,
+                 java.util.Date" %>
+<%@ page session="false" contentType="text/html;charset=utf-8" %>
+<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
+<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
+<%@ taglib uri="http://myfaces.apache.org/commons/components" prefix="mc" %>
+<html>
+
+<%@ include file="inc/head.inc" %>
+
+<!--
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+//-->
+
+<body>
+
+<f:view>
+
+    <h:form>
+    	<p>This component allows to export the datatable contents to an excel or pdf file.</p>
+		
+		<br>
+		
+		<h:dataTable id="tbl_cars"
+                styleClass="scrollerTable"
+                headerClass="standardTable_Header"
+                footerClass="standardTable_Header"
+                rowClasses="standardTable_Row1,standardTable_Row2"
+                columnClasses="standardTable_Column,standardTable_ColumnCentered,standardTable_Column"
+                var="car"
+                value="#{exporterBean.carsList}">
+           <h:column>
+               <f:facet name="header">
+                   <h:outputText value="Id" />
+               </f:facet>
+               <h:outputText value="#{car.id}" />
+           </h:column>
+
+           <h:column>
+               <f:facet name="header">
+                  <h:outputText value="Type" />
+               </f:facet>
+               <h:outputText value="#{car.type}" />
+           </h:column>
+
+           <h:column>
+               <f:facet name="header">
+                  <h:outputText value="Color" />
+               </f:facet>
+               <h:outputText value="#{car.color}" />
+           </h:column>
+
+        </h:dataTable>
+        
+		<br>
+		
+		<h:commandButton action="#{exporterBean.export}" value="Export as excel">
+			<mc:exporterActionListener for="tbl_cars" fileType="XLS"/>
+		</h:commandButton>			
+		
+		<br>
+		
+		<h:commandButton action="#{exporterBean.export}" value="Export as pdf">
+			<mc:exporterActionListener for="tbl_cars" fileType="PDF"/>
+		</h:commandButton>
+			
+		
+    </h:form>
+</f:view>
+
+<%@ include file="inc/page_footer.jsp" %>
+
+</body>
+
+</html>

Modified: myfaces/commons/trunk/myfaces-commons-examples/src/main/webapp/home.jsp
URL: http://svn.apache.org/viewvc/myfaces/commons/trunk/myfaces-commons-examples/src/main/webapp/home.jsp?rev=719948&r1=719947&r2=719948&view=diff
==============================================================================
--- myfaces/commons/trunk/myfaces-commons-examples/src/main/webapp/home.jsp (original)
+++ myfaces/commons/trunk/myfaces-commons-examples/src/main/webapp/home.jsp Sat Nov 22 19:37:32 2008
@@ -53,6 +53,9 @@
             <h:outputLink value="convertEnum.jsf">
                 <f:verbatim>ConvertEnum</f:verbatim>
             </h:outputLink>
+            <h:outputLink value="exporter.jsf">
+                <f:verbatim>Exporter - Export datatable contents as an excel file or as a pdf file</f:verbatim>
+            </h:outputLink>                   
 		</h:panelGrid>
 	</h:form>