You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beehive.apache.org by do...@apache.org on 2005/02/10 00:32:35 UTC

svn commit: r153130 - in incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/coretags/form/cases: ./ Controller.jpf index.jsp

Author: dolander
Date: Wed Feb  9 15:32:31 2005
New Revision: 153130

URL: http://svn.apache.org/viewcvs?view=rev&rev=153130
Log:
Adding the start of a test of Form Posting


Added:
    incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/coretags/form/cases/
    incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/coretags/form/cases/Controller.jpf
    incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/coretags/form/cases/index.jsp

Added: incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/coretags/form/cases/Controller.jpf
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/coretags/form/cases/Controller.jpf?view=auto&rev=153130
==============================================================================
--- incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/coretags/form/cases/Controller.jpf (added)
+++ incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/coretags/form/cases/Controller.jpf Wed Feb  9 15:32:31 2005
@@ -0,0 +1,128 @@
+package coretags.form.cases;
+
+import javax.servlet.http.HttpSession;
+import org.apache.beehive.netui.pageflow.FormData;
+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.netui.tags.tree.TreeElement;
+
+/**
+ * This is the default controller for a blank web application.
+ */
+@Jpf.Controller
+public class Controller extends PageFlowController
+{
+    private String _action;
+    private String _text;
+
+    public String getAction() {
+	return _action;
+    }
+    public String getText() {
+	return _text;
+    }
+    public void setText(String text) {
+	_text = text;
+    }
+
+    @Jpf.Action(
+        forwards={
+           @Jpf.Forward(name="index", path="index.jsp")
+        }
+    )
+    protected Forward begin()
+    {
+	_action = "begin";
+        return new Forward("index");
+    }
+
+    @Jpf.Action(
+        forwards={
+           @Jpf.Forward(name="index", path="index.jsp")
+        }
+    )
+    protected Forward post(Bean form)
+    {
+	_action = "post";
+	_text = form.getText();
+        return new Forward("index");
+    }
+
+    @Jpf.Action(
+        forwards={
+           @Jpf.Forward(name="index", path="index.jsp")
+        }
+    )
+    protected Forward postNoForm()
+    {
+	_action = "postNoForm";
+        return new Forward("index");
+    }
+
+    @Jpf.Action(
+        forwards={
+           @Jpf.Forward(name="index", path="index.jsp")
+        }
+    )
+    protected Forward postOverride(Bean form)
+    {
+	_action = "postOverride";
+	_text = form.getText();
+        return new Forward("index");
+    }
+
+    @Jpf.Action(
+        forwards={
+           @Jpf.Forward(name="index", path="index.jsp")
+        }
+    )
+    protected Forward postOverrideNewForm(BeanTwo form)
+    {
+	_action = "postOverrideNewForm";
+	_text = form.getText();
+        return new Forward("index");
+    }
+
+    /**
+     * Callback that is invoked when this controller instance is created.
+     */
+    protected void onCreate()
+    {
+    }
+
+    /**
+     * Callback that is invoked when this controller instance is destroyed.
+     */
+    protected void onDestroy(HttpSession session)
+    {
+    }
+
+    public static class Bean extends FormData
+    {
+        private String _text;
+        public String getText()
+        {
+            return _text;
+        }
+
+        public void setText(String value)
+        {
+            _text = value;
+        }
+    }
+
+    public static class BeanTwo extends FormData
+    {
+        private String _text;
+        public String getText()
+        {
+            return _text;
+        }
+
+        public void setText(String value)
+        {
+            _text = value;
+        }
+    }
+}

Added: incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/coretags/form/cases/index.jsp
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/coretags/form/cases/index.jsp?view=auto&rev=153130
==============================================================================
--- incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/coretags/form/cases/index.jsp (added)
+++ incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/coretags/form/cases/index.jsp Wed Feb  9 15:32:31 2005
@@ -0,0 +1,48 @@
+<%@ page language="java" contentType="text/html;charset=UTF-8"%>
+<%@ taglib prefix="netui" uri="http://beehive.apache.org/netui/tags-html-1.0"%>
+
+<netui:html documentType="xhtml1-transitional">
+    <head>
+        <netui:base/>
+    </head>
+    <netui:body>
+        Action: <netui:span value="${pageFlow.action}" /><br>
+        Text: <netui:span value="${pageFlow.text}" />
+	<table width="100%">
+	<tr><td width="50%">
+	<h4>Case One -- Form Submit to an Action</h4>
+	<netui:scriptContainer generateIdScope="true">
+           <netui:form action="post">
+	       Text: <netui:textBox dataSource="actionForm.text" />
+	       <netui:button value="submit"/>
+	   </netui:form>
+        </netui:scriptContainer>
+         </td><td width="50%">
+	<h4>Case Two -- Form Submit To PageFlow</h4>
+	<netui:scriptContainer generateIdScope="true">
+           <netui:form action="postNoForm">
+	       Text: <netui:textBox dataSource="pageFlow.text" />
+	       <netui:button value="submit"/>
+	   </netui:form>
+        </netui:scriptContainer>
+	</td></tr>
+	<tr><td width="50%">
+	<h4>Case Three -- Form Submit Override Action</h4>
+	<netui:scriptContainer generateIdScope="true">
+           <netui:form action="post">
+	       Text: <netui:textBox dataSource="actionForm.text" />
+	       <netui:button action="postOverride" value="submit"/>
+	   </netui:form>
+        </netui:scriptContainer>
+         </td><td width="50%">
+	<h4>Case Four -- Form Submit Override Action/Different Bean</h4>
+	<netui:scriptContainer generateIdScope="true">
+           <netui:form action="post">
+	       Text: <netui:textBox dataSource="actionForm.text" />
+	       <netui:button action="postOverrideNewForm" value="submit"/>
+	   </netui:form>
+        </netui:scriptContainer>
+	</td></tr>
+        </table>
+    </netui:body>
+</netui:html>