You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beehive.apache.org by ek...@apache.org on 2005/05/24 21:55:58 UTC

svn commit: r178263 - in /incubator/beehive/trunk/samples/netui-samples: index.jsp ui/pageinput/ ui/pageinput/Controller.java ui/pageinput/index.jsp

Author: ekoneil
Date: Tue May 24 12:55:57 2005
New Revision: 178263

URL: http://svn.apache.org/viewcvs?rev=178263&view=rev
Log:
Add page input sample to netui-samples.

BB: self
DRT: netui-samples builds / runs


Added:
    incubator/beehive/trunk/samples/netui-samples/ui/pageinput/
    incubator/beehive/trunk/samples/netui-samples/ui/pageinput/Controller.java
    incubator/beehive/trunk/samples/netui-samples/ui/pageinput/index.jsp
Modified:
    incubator/beehive/trunk/samples/netui-samples/index.jsp

Modified: incubator/beehive/trunk/samples/netui-samples/index.jsp
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/samples/netui-samples/index.jsp?rev=178263&r1=178262&r2=178263&view=diff
==============================================================================
--- incubator/beehive/trunk/samples/netui-samples/index.jsp (original)
+++ incubator/beehive/trunk/samples/netui-samples/index.jsp Tue May 24 12:55:57 2005
@@ -53,5 +53,9 @@
       <dt><netui:anchor href="ui/formposting/Controller.jpf" value="Form Posting"/></dt>
       <dd>Demonstrates how to use a Page Flow and NetUI JSP tags to handle an HTML form POST.</dd>
     </dl>
+    <dl>
+      <dt><netui:anchor href="ui/pageinput/Controller.jpf" value="Page Input"/></dt>
+      <dd>Demonstrates how to use a Page Flow page inputs to pass data from an action to a JSP page.</dd>
+    </dl>
   </netui-template:section>
 </netui-template:template>

Added: incubator/beehive/trunk/samples/netui-samples/ui/pageinput/Controller.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/samples/netui-samples/ui/pageinput/Controller.java?rev=178263&view=auto
==============================================================================
--- incubator/beehive/trunk/samples/netui-samples/ui/pageinput/Controller.java (added)
+++ incubator/beehive/trunk/samples/netui-samples/ui/pageinput/Controller.java Tue May 24 12:55:57 2005
@@ -0,0 +1,63 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ *
+ * $Header:$
+ */
+package ui.pageinput;
+
+import org.apache.beehive.netui.pageflow.PageFlowController;
+import org.apache.beehive.netui.pageflow.Forward;
+import org.apache.beehive.netui.pageflow.annotations.Jpf;
+import org.apache.beehive.samples.netui.beans.PetType;
+
+/**
+ *
+ */
+@Jpf.Controller(
+    forwards={@Jpf.Forward(name="success", path="index.jsp")}
+)
+public class Controller
+    extends PageFlowController{
+
+    @Jpf.Action(
+        forwards={
+            @Jpf.Forward(name="success", path="index.jsp",
+                         actionOutputs={
+                             @Jpf.ActionOutput(
+                                 name="pet",
+                                 type=PetType.class,
+                                 required=true)
+                        }
+            )
+        }
+    )
+    protected Forward begin() {
+        PetType petType = new PetType();
+        petType.setPetId(1234);
+        petType.setName("Labrador Retriever");
+        petType.setPrice(600.00);
+        petType.setDescription("Black Labrador Retriever");
+
+        Forward f = new Forward("success");
+        f.addActionOutput("pet", petType);
+        return f;
+    }
+
+    @Jpf.Action()
+    protected Forward missingPageInput() {
+        return new Forward("success");
+    }
+
+}

Added: incubator/beehive/trunk/samples/netui-samples/ui/pageinput/index.jsp
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/samples/netui-samples/ui/pageinput/index.jsp?rev=178263&view=auto
==============================================================================
--- incubator/beehive/trunk/samples/netui-samples/ui/pageinput/index.jsp (added)
+++ incubator/beehive/trunk/samples/netui-samples/ui/pageinput/index.jsp Tue May 24 12:55:57 2005
@@ -0,0 +1,46 @@
+<%--
+   Copyright 2004-2005 The Apache Software Foundation.
+
+   Licensed 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.
+
+   $Header:$
+--%>
+<%@ page language="java" contentType="text/html;charset=UTF-8"%>
+<%@ taglib uri="http://beehive.apache.org/netui/tags-databinding-1.0" prefix="netui-data"%>
+<%@ taglib uri="http://beehive.apache.org/netui/tags-html-1.0" prefix="netui"%>
+<%@ taglib uri="http://beehive.apache.org/netui/tags-template-1.0" prefix="netui-template"%>
+
+<netui-template:template templatePage="/resources/template/template.jsp">
+  <netui-template:setAttribute name="samTitle" value="Page Inputs"/>
+  <netui-template:section name="main">
+      
+      <netui-data:declarePageInput name="pet" type="org.apache.beehive.samples.netui.beans.PetType"/>
+
+      <br/>
+      <table>
+          <tr><td colspan="2"><b>Pet Details</b></td></tr>
+          <tr><td>Identifier:</td><td>${pageInput.pet.petID}</td></tr>
+          <tr><td>Name:</td><td>${pageInput.pet.name}</td></tr>
+          <tr><td>Price:</td><td>${pageInput.pet.price}</td></tr>
+      <tr><td>Description:</td><td>${pageInput.pet.description}</td></tr>
+      </table>
+      <br/>
+      Click <netui:anchor action="missingPageInput" value="here"/> to run this page
+      via an action that <i>does not</i> provide the required page input.
+      <br/>
+      <br/>
+      Click <netui:anchor action="begin" value="here"/> to run this page via an action
+      that <i>does</i> provide the required page input.
+      <br/>
+  </netui-template:section>
+</netui-template:template>
\ No newline at end of file