You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by mr...@apache.org on 2006/01/25 07:03:56 UTC

svn commit: r372127 - in /struts/flow/trunk/src: examples/ examples/WEB-INF/templates/views/guess/ java/org/apache/struts/flow/ java/org/apache/struts/flow/core/javascript/fom/

Author: mrdon
Date: Tue Jan 24 22:03:54 2006
New Revision: 372127

URL: http://svn.apache.org/viewcvs?rev=372127&view=rev
Log:
Added the new controller and view naming convention, fixed bad link on
templates example, added call to "unknown" action if desired not found

Modified:
    struts/flow/trunk/src/examples/WEB-INF/templates/views/guess/endGame.jt
    struts/flow/trunk/src/examples/index.html
    struts/flow/trunk/src/java/org/apache/struts/flow/FlowAction.java
    struts/flow/trunk/src/java/org/apache/struts/flow/core/javascript/fom/FOM_JavaScriptInterpreter.java
    struts/flow/trunk/src/java/org/apache/struts/flow/struts-config.xml

Modified: struts/flow/trunk/src/examples/WEB-INF/templates/views/guess/endGame.jt
URL: http://svn.apache.org/viewcvs/struts/flow/trunk/src/examples/WEB-INF/templates/views/guess/endGame.jt?rev=372127&r1=372126&r2=372127&view=diff
==============================================================================
--- struts/flow/trunk/src/examples/WEB-INF/templates/views/guess/endGame.jt (original)
+++ struts/flow/trunk/src/examples/WEB-INF/templates/views/guess/endGame.jt Tue Jan 24 22:03:54 2006
@@ -13,6 +13,6 @@
   
   <p><a href="play.do">Play again</a></p>
   
-  <a href="../index.html">Return to index</a>  
+  <a href="../../index.html">Return to index</a>  
 </body>
 </html>

Modified: struts/flow/trunk/src/examples/index.html
URL: http://svn.apache.org/viewcvs/struts/flow/trunk/src/examples/index.html?rev=372127&r1=372126&r2=372127&view=diff
==============================================================================
--- struts/flow/trunk/src/examples/index.html (original)
+++ struts/flow/trunk/src/examples/index.html Tue Jan 24 22:03:54 2006
@@ -8,18 +8,18 @@
   in Struts Flow:
   </p>
   <ul>
-    <li><a href="guess/NumberGuess/play.do">Number Guess Example</a> - Shows a simple
+    <li><a href="guess/guess/play.do">Number Guess Example</a> - Shows a simple
         number guessing game to demonstrate the use of continuations.</li>
-    <li><a href="remote/NumberGuess/play.do">Number Guess Example - Remote Edition</a> - 
+    <li><a href="remote/guess/play.do">Number Guess Example - Remote Edition</a> - 
         Shows the above example but adding a remote rpc or (Ajax) example by
         adding a "cheat" button that retrieves the number from the server
         without reloading the page.</li>
-    <li><a href="templates/NumberGuess/play.do">Number Guess Example - Template Edition</a> - 
+    <li><a href="templates/guess/play.do">Number Guess Example - Template Edition</a> - 
         Shows the remote example but using <a 
         href="http://www.trimpath.com/project/wiki/JavaScriptTemplates">Javascript 
         Templates</a> to render HTML on both the server instead of JSP and client
         instead of string contatenations.</li>
-    <li><a href="wizard/Registration/start.do">Registration Wizard Example</a> - 
+    <li><a href="wizard/registration/register.do">Registration Wizard Example</a> - 
         Shows a simple server-side wizard framework built on continuations
         with automatic back button support both from a form and browser 
         button.</li>

Modified: struts/flow/trunk/src/java/org/apache/struts/flow/FlowAction.java
URL: http://svn.apache.org/viewcvs/struts/flow/trunk/src/java/org/apache/struts/flow/FlowAction.java?rev=372127&r1=372126&r2=372127&view=diff
==============================================================================
--- struts/flow/trunk/src/java/org/apache/struts/flow/FlowAction.java (original)
+++ struts/flow/trunk/src/java/org/apache/struts/flow/FlowAction.java Tue Jan 24 22:03:54 2006
@@ -149,10 +149,15 @@
                 if (id != null) {
                     args.add(new Interpreter.Argument("id", id));
                 }
-                
+               
+                // modify controller name
+                StringBuffer sb = new StringBuffer();
+                sb.append(Character.toUpperCase(controller.charAt(0)));
+                sb.append(controller.substring(1));
+                sb.append("Controller");
+               
                 // call control script function
-                
-                interp.callController(controller, func, args, context);
+                interp.callController(sb.toString(), func, args, context);
                 
                 return dispatchToPage(request, response, mapping, forward);
             }

Modified: struts/flow/trunk/src/java/org/apache/struts/flow/core/javascript/fom/FOM_JavaScriptInterpreter.java
URL: http://svn.apache.org/viewcvs/struts/flow/trunk/src/java/org/apache/struts/flow/core/javascript/fom/FOM_JavaScriptInterpreter.java?rev=372127&r1=372126&r2=372127&view=diff
==============================================================================
--- struts/flow/trunk/src/java/org/apache/struts/flow/core/javascript/fom/FOM_JavaScriptInterpreter.java (original)
+++ struts/flow/trunk/src/java/org/apache/struts/flow/core/javascript/fom/FOM_JavaScriptInterpreter.java Tue Jan 24 22:03:54 2006
@@ -103,6 +103,11 @@
     private static final String USER_GLOBAL_SCOPE = "FOM JavaScript GLOBAL SCOPE/";
 
     /**
+     * The function name to call if the desired function cannot be found.
+     */
+    private static final String MISSING_FUNCTION_NAME = "unknown";
+
+    /**
      * This is the only optimization level that supports continuations
      * in the Christoper Oliver's Rhino JavaScript implementation
      */
@@ -845,7 +850,12 @@
                     }
                     Object fun = ScriptableObject.getProperty(controller, funName);
                     if (fun == Scriptable.NOT_FOUND) {
-                        throw new FlowException("Function \"javascript:" + funName + "()\" not found");
+                        getLogger().info("Function \"javascript:" + funName + "()\" not found");
+                        fun = ScriptableObject.getProperty(controller, MISSING_FUNCTION_NAME);
+                        if (fun == Scriptable.NOT_FOUND) {
+                            throw new FlowException("Unable to find either the " + funName +
+                                " or " + MISSING_FUNCTION_NAME + " function.");
+                        }        
                     }
                     useFlash(webctx, controller);
                     initFlowVariables(thrScope.getFlowVariables(), webctx);

Modified: struts/flow/trunk/src/java/org/apache/struts/flow/struts-config.xml
URL: http://svn.apache.org/viewcvs/struts/flow/trunk/src/java/org/apache/struts/flow/struts-config.xml?rev=372127&r1=372126&r2=372127&view=diff
==============================================================================
--- struts/flow/trunk/src/java/org/apache/struts/flow/struts-config.xml (original)
+++ struts/flow/trunk/src/java/org/apache/struts/flow/struts-config.xml Tue Jan 24 22:03:54 2006
@@ -20,9 +20,9 @@
       <set-property key="controller" value="{1}" />
       <set-property key="function" value="{2}" />
       <set-property key="id" value="{3}" />
-      <set-property key="script" value="$M/flow/$C.js" />
+      <set-property key="script" value="$M/controllers/$CController.js" />
       
-      <forward name="forward" path="/WEB-INF$M/jsp/$A.jsp" />
+      <forward name="forward" path="/WEB-INF$M/views/$C/$A.jsp" />
       <forward name="redirect" path="$M/$C/$A.do" redirect="true" /> 
     </action>
     



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org