You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lo...@apache.org on 2010/04/08 14:11:50 UTC

svn commit: r931900 - in /myfaces/tobago/trunk/example/demo/src/main: java/org/apache/myfaces/tobago/example/reference/SimpleBeanList.java webapp/WEB-INF/faces-config.xml webapp/reference/sheet.jsp

Author: lofwyr
Date: Thu Apr  8 12:11:49 2010
New Revision: 931900

URL: http://svn.apache.org/viewvc?rev=931900&view=rev
Log:
Clean up example. (don't use Java code on the page)

Added:
    myfaces/tobago/trunk/example/demo/src/main/java/org/apache/myfaces/tobago/example/reference/SimpleBeanList.java
Modified:
    myfaces/tobago/trunk/example/demo/src/main/webapp/WEB-INF/faces-config.xml
    myfaces/tobago/trunk/example/demo/src/main/webapp/reference/sheet.jsp

Added: myfaces/tobago/trunk/example/demo/src/main/java/org/apache/myfaces/tobago/example/reference/SimpleBeanList.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/example/demo/src/main/java/org/apache/myfaces/tobago/example/reference/SimpleBeanList.java?rev=931900&view=auto
==============================================================================
--- myfaces/tobago/trunk/example/demo/src/main/java/org/apache/myfaces/tobago/example/reference/SimpleBeanList.java (added)
+++ myfaces/tobago/trunk/example/demo/src/main/java/org/apache/myfaces/tobago/example/reference/SimpleBeanList.java Thu Apr  8 12:11:49 2010
@@ -0,0 +1,38 @@
+package org.apache.myfaces.tobago.example.reference;
+
+/*
+ * 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.
+ */
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.util.ArrayList;
+
+public class SimpleBeanList extends ArrayList<SimpleBean> {
+
+  private static final Log LOG = LogFactory.getLog(SimpleBeanList.class);
+
+  public SimpleBeanList() {
+    add(new SimpleBean(1, "One"));
+    add(new SimpleBean(2, "Two"));
+    add(new SimpleBean(3, "Three"));
+    add(new SimpleBean(4, "Four"));
+    add(new SimpleBean(5000000, "Five Million"));
+
+    LOG.info("Created!");
+  }
+}

Modified: myfaces/tobago/trunk/example/demo/src/main/webapp/WEB-INF/faces-config.xml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/example/demo/src/main/webapp/WEB-INF/faces-config.xml?rev=931900&r1=931899&r2=931900&view=diff
==============================================================================
--- myfaces/tobago/trunk/example/demo/src/main/webapp/WEB-INF/faces-config.xml (original)
+++ myfaces/tobago/trunk/example/demo/src/main/webapp/WEB-INF/faces-config.xml Thu Apr  8 12:11:49 2010
@@ -356,6 +356,12 @@
     <managed-bean-class>org.apache.myfaces.tobago.example.reference.Upload</managed-bean-class>
     <managed-bean-scope>session</managed-bean-scope>
   </managed-bean>
+
+  <managed-bean>
+    <managed-bean-name>simpleList</managed-bean-name>
+    <managed-bean-class>org.apache.myfaces.tobago.example.reference.SimpleBeanList</managed-bean-class>
+    <managed-bean-scope>request</managed-bean-scope>
+  </managed-bean>
   
   <navigation-rule>
     <navigation-case>

Modified: myfaces/tobago/trunk/example/demo/src/main/webapp/reference/sheet.jsp
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/example/demo/src/main/webapp/reference/sheet.jsp?rev=931900&r1=931899&r2=931900&view=diff
==============================================================================
--- myfaces/tobago/trunk/example/demo/src/main/webapp/reference/sheet.jsp (original)
+++ myfaces/tobago/trunk/example/demo/src/main/webapp/reference/sheet.jsp Thu Apr  8 12:11:49 2010
@@ -14,72 +14,55 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
 --%>
-<%@ page import="org.apache.myfaces.tobago.example.reference.SimpleBean" %>
-
-<%
-  SimpleBean[] simpleList = (SimpleBean[]) session.getAttribute("simpleList");
-  System.out.println("1" + session.getAttribute("simpleList"));
-  if (simpleList == null) {
-    simpleList = new SimpleBean[]{
-        new SimpleBean(1, "One"),
-        new SimpleBean(2, "Two"),
-        new SimpleBean(3, "Three"),
-        new SimpleBean(4, "Four"),
-        new SimpleBean(5000000, "Five Million")};
-  }
-  session.setAttribute("simpleList", simpleList);
-  System.out.println("2" + session.getAttribute("simpleList"));
-%>
-
 <%@ taglib uri="http://myfaces.apache.org/tobago/component" prefix="tc" %>
 <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
 <%@ taglib tagdir="/WEB-INF/tags/layout" prefix="layout" %>
 
 <layout:overview>
-    <jsp:body>
-      <tc:box label="Sheet">
-        <f:facet name="layout">
-          <tc:gridLayout rows="fixed;*;fixed;fixed;fixed"/>
+  <jsp:body>
+    <tc:box label="Sheet">
+      <f:facet name="layout">
+        <tc:gridLayout rows="fixed;*;fixed;fixed;fixed"/>
+      </f:facet>
+
+      <tc:messages/>
+
+      <tc:sheet value="#{simpleList}" columns="fixed;*" var="bean" rows="5">
+        <tc:columnSelector/>
+        <tc:column label="Number">
+          <tc:in value="#{bean.value}" required="true"/>
+        </tc:column>
+      </tc:sheet>
+
+      <tc:separator>
+        <f:facet name="label">
+          <tc:label value="Layout: Sheet with 'fixed' height"/>
         </f:facet>
+      </tc:separator>
 
-        <tc:messages/>
+      <tc:sheet value="#{simpleList}" columns="*;*;*" var="bean" rows="5">
+        <tc:column label="Cipher">
+          <tc:out value="#{bean.number}"/>
+        </tc:column>
+        <tc:column label="Name">
+          <tc:out value="#{bean.value}"/>
+        </tc:column>
+        <tc:column label="Date">
+          <tc:out value="#{bean.date}">
+            <f:convertDateTime dateStyle="medium" type="date"/>
+          </tc:out>
+        </tc:column>
+      </tc:sheet>
 
-        <tc:sheet value="#{simpleList}" columns="fixed;*" var="bean">
-          <tc:columnSelector />
-          <tc:column label="Number">
-            <tc:in value="#{bean.value}" required="true"/>
-          </tc:column>
-        </tc:sheet>
-
-        <tc:separator >
-          <f:facet name="label">
-            <tc:label value="Layout: Sheet with 'fixed' height"/>
-          </f:facet>
-        </tc:separator>
-
-        <tc:sheet value="#{simpleList}" columns="*;*;*" var="bean" rows="5">
-          <tc:column label="Cipher">
-            <tc:out value="#{bean.number}"/>
-          </tc:column>
-          <tc:column label="Name">
-            <tc:out value="#{bean.value}"/>
-          </tc:column>
-          <tc:column label="Date">
-            <tc:out value="#{bean.date}">
-              <f:convertDateTime dateStyle="medium" type="date"/>
-            </tc:out>
-          </tc:column>
-        </tc:sheet>
-
-        <tc:panel>
-          <f:facet name="layout">
-            <tc:gridLayout columns="*;fixed"   />
-          </f:facet>
-          <tc:cell/>
-          <tc:button action="submit" label="Submit" />
-        </tc:panel>
+      <tc:panel>
+        <f:facet name="layout">
+          <tc:gridLayout columns="*;fixed"/>
+        </f:facet>
+        <tc:cell/>
+        <tc:button action="submit" label="Submit"/>
+      </tc:panel>
 
-      </tc:box>
+    </tc:box>
 
-    </jsp:body>
+  </jsp:body>
 </layout:overview>