Author: husted
Date: Fri Mar 17 10:05:00 2006
New Revision: 386680

URL: http://svn.apache.org/viewcvs?rev=386680&view=rev
Log:
Action2 Apps
* Change forms to use POST method. 
* Remove some play-test code. 




Added:
    struts/sandbox/trunk/action2/PRACTICES.txt   (with props)
Modified:
    
struts/sandbox/trunk/action2/apps/cookbook/src/java/cookbook2/pojo/Result.java
    
struts/sandbox/trunk/action2/apps/cookbook/src/webapp/pages/ActionTag/Input.jsp
    struts/sandbox/trunk/action2/apps/cookbook/src/webapp/pages/Pojo/Input.jsp
    struts/sandbox/trunk/action2/apps/cookbook/src/webapp/pages/Select/Input.jsp
    struts/sandbox/trunk/action2/apps/cookbook/src/webapp/pages/Simple/Input.jsp

Added: struts/sandbox/trunk/action2/PRACTICES.txt
URL: 
http://svn.apache.org/viewcvs/struts/sandbox/trunk/action2/PRACTICES.txt?rev=386680&view=auto
==============================================================================
--- struts/sandbox/trunk/action2/PRACTICES.txt (added)
+++ struts/sandbox/trunk/action2/PRACTICES.txt Fri Mar 17 10:05:00 2006
@@ -0,0 +1,39 @@
+Action2 Apps Best Practices
+
+* Link only to actions, never to server pages or templates
+
+* Do not expose the action extension in your tags. Use the action parameter 
instead.
+
+* Use namespaces to organize your application into logical "modules" or units 
of work.
+
+* Place each namespace into it's own Xwork config.
+ ** Try to keep the Actions classes for the namespace in a common package.
+ ** Store the Xwork configuration for that namespace with the Actions.
+ ** If you are using JSPs, try to name the JSP folder after the Action package.
+ ** If you using templates, bundle the templates with the Actions.
+ ** Remember, if the namespace needs to change, you do not need to change 
packages or JSP folders, if you don't want to.
+
+* Within a namespace, resuse names for common concepts. If each namespace has 
an entry page, use the same action name in each namespace. For example, each 
namespace in the Cookbook has an "Open" action.
+
+* Unit test actions before trying them in a web application.
+  ** Since JUnit is integrated in most IDEs now, there is no excuse.
+
+* Consider using WebCanoo, HtmlUnit, or HttpUnit to test navigation, as the 
application is being developed.
+
+* Use SiteMesh, or the equivalent, to separate application "chrome" from the 
core utility of the server pages.
+
+* Specify the POST method for forums, unless there is a reason to use the 
default GET method.
+
+* If an image, or other swatch of markup, is being used by multiple pages, 
remove it to its own server page and include it where necessary.
+ ** Better yet, encapsulate the markup in its own UI tag.
+
+* Extend the UI tags as needed.
+
+* Consider using the message resources for page titles, control labels, and so 
forth, even if the application is not being localized.
+ ** It is often useful to seperate the concern of what message to display form 
the concern of where to display it.
+
+* Use the XML framework to validate input.
+
+* Do not embed business logic in action classes.
+ ** Remove business logic to a business facade that the actions can call. 
(Spring is an excellent way to build a business facade.)
+ ** Actions are a necessary evil. Every line of code in an Action is guilty 
until proven innocent. Ideally, there should be one line of code that calls the 
business facade, and every other line of a code in an action should be bound to 
the framework.

Propchange: struts/sandbox/trunk/action2/PRACTICES.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: 
struts/sandbox/trunk/action2/apps/cookbook/src/java/cookbook2/pojo/Result.java
URL: 
http://svn.apache.org/viewcvs/struts/sandbox/trunk/action2/apps/cookbook/src/java/cookbook2/pojo/Result.java?rev=386680&r1=386679&r2=386680&view=diff
==============================================================================
--- 
struts/sandbox/trunk/action2/apps/cookbook/src/java/cookbook2/pojo/Result.java 
(original)
+++ 
struts/sandbox/trunk/action2/apps/cookbook/src/java/cookbook2/pojo/Result.java 
Fri Mar 17 10:05:00 2006
@@ -11,10 +11,4 @@
         return directoryEntry;
     }
 
-    public String method1() {
-
-        directoryEntry.setHours(new Integer(37));
-
-        return SUCCESS;
-    }
 }

Modified: 
struts/sandbox/trunk/action2/apps/cookbook/src/webapp/pages/ActionTag/Input.jsp
URL: 
http://svn.apache.org/viewcvs/struts/sandbox/trunk/action2/apps/cookbook/src/webapp/pages/ActionTag/Input.jsp?rev=386680&r1=386679&r2=386680&view=diff
==============================================================================
--- 
struts/sandbox/trunk/action2/apps/cookbook/src/webapp/pages/ActionTag/Input.jsp 
(original)
+++ 
struts/sandbox/trunk/action2/apps/cookbook/src/webapp/pages/ActionTag/Input.jsp 
Fri Mar 17 10:05:00 2006
@@ -17,7 +17,7 @@
         Accordingly, each control could be re-used on any number of pages.
     </p>
 
-<ww:form>
+<ww:form method="POST">
 
     <ww:action name="languages" namespace="/ActionTag" executeResult="true" />
 

Modified: 
struts/sandbox/trunk/action2/apps/cookbook/src/webapp/pages/Pojo/Input.jsp
URL: 
http://svn.apache.org/viewcvs/struts/sandbox/trunk/action2/apps/cookbook/src/webapp/pages/Pojo/Input.jsp?rev=386680&r1=386679&r2=386680&view=diff
==============================================================================
--- struts/sandbox/trunk/action2/apps/cookbook/src/webapp/pages/Pojo/Input.jsp 
(original)
+++ struts/sandbox/trunk/action2/apps/cookbook/src/webapp/pages/Pojo/Input.jsp 
Fri Mar 17 10:05:00 2006
@@ -7,7 +7,7 @@
 
 <body>
 
-<ww:form>
+<ww:form method="POST">
     <ww:textfield
                label="First Name"
                name="firstname"
@@ -44,8 +44,6 @@
             tooltip="Are you authorized to edit directory entries?"/>
 
     <ww:submit />
-    <ww:submit value="Metdod 1" action="Open!method1" />
-
 </ww:form>
 
 </body>

Modified: 
struts/sandbox/trunk/action2/apps/cookbook/src/webapp/pages/Select/Input.jsp
URL: 
http://svn.apache.org/viewcvs/struts/sandbox/trunk/action2/apps/cookbook/src/webapp/pages/Select/Input.jsp?rev=386680&r1=386679&r2=386680&view=diff
==============================================================================
--- 
struts/sandbox/trunk/action2/apps/cookbook/src/webapp/pages/Select/Input.jsp 
(original)
+++ 
struts/sandbox/trunk/action2/apps/cookbook/src/webapp/pages/Select/Input.jsp 
Fri Mar 17 10:05:00 2006
@@ -7,7 +7,7 @@
 
 <body>
 
-<ww:form>
+<ww:form method="POST">
     <ww:textfield
                label="Name"
                name="name"

Modified: 
struts/sandbox/trunk/action2/apps/cookbook/src/webapp/pages/Simple/Input.jsp
URL: 
http://svn.apache.org/viewcvs/struts/sandbox/trunk/action2/apps/cookbook/src/webapp/pages/Simple/Input.jsp?rev=386680&r1=386679&r2=386680&view=diff
==============================================================================
--- 
struts/sandbox/trunk/action2/apps/cookbook/src/webapp/pages/Simple/Input.jsp 
(original)
+++ 
struts/sandbox/trunk/action2/apps/cookbook/src/webapp/pages/Simple/Input.jsp 
Fri Mar 17 10:05:00 2006
@@ -5,7 +5,7 @@
         <ww:head/>
     </head>
     <body>
-        <ww:form>
+        <ww:form method="POST">
             <ww:textfield label="Please enter your name" name="name" />
             <ww:submit />
         </ww:form>



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to