Author: husted
Date: Tue Dec  6 13:12:43 2005
New Revision: 354559

URL: http://svn.apache.org/viewcvs?rev=354559&view=rev
Log:
MailReader 
* Refactor configuration to use renamed JSPs 
** Initial-case JSPs are easier to invoke from WildCard mappings
* Refactor Action to use BaseAction and constants for forward tokens
* Pass WebTests 

Modified:
    
struts/apps/trunk/mailreader/src/java/org/apache/struts/apps/mailreader/Constants.java
    
struts/apps/trunk/mailreader/src/java/org/apache/struts/apps/mailreader/actions/BaseAction.java
    
struts/apps/trunk/mailreader/src/java/org/apache/struts/apps/mailreader/actions/EditRegistrationAction.java
    
struts/apps/trunk/mailreader/src/java/org/apache/struts/apps/mailreader/actions/EditSubscriptionAction.java
    
struts/apps/trunk/mailreader/src/java/org/apache/struts/apps/mailreader/actions/LogoffAction.java
    
struts/apps/trunk/mailreader/src/java/org/apache/struts/apps/mailreader/actions/LogonAction.java
    
struts/apps/trunk/mailreader/src/java/org/apache/struts/apps/mailreader/actions/SaveRegistrationAction.java
    
struts/apps/trunk/mailreader/src/java/org/apache/struts/apps/mailreader/actions/SaveSubscriptionAction.java
    struts/apps/trunk/mailreader/src/webapp/Logon.jsp
    struts/apps/trunk/mailreader/src/webapp/MainMenu.jsp
    struts/apps/trunk/mailreader/src/webapp/Registration.jsp
    struts/apps/trunk/mailreader/src/webapp/StaticJavascript.jsp
    
struts/apps/trunk/mailreader/src/webapp/WEB-INF/struts-config-registration.xml
    struts/apps/trunk/mailreader/src/webapp/WEB-INF/struts-config.xml
    struts/apps/trunk/mailreader/src/webapp/WEB-INF/webtest.xml
    struts/apps/trunk/mailreader/src/webapp/tour.html

Modified: 
struts/apps/trunk/mailreader/src/java/org/apache/struts/apps/mailreader/Constants.java
URL: 
http://svn.apache.org/viewcvs/struts/apps/trunk/mailreader/src/java/org/apache/struts/apps/mailreader/Constants.java?rev=354559&r1=354558&r2=354559&view=diff
==============================================================================
--- 
struts/apps/trunk/mailreader/src/java/org/apache/struts/apps/mailreader/Constants.java
 (original)
+++ 
struts/apps/trunk/mailreader/src/java/org/apache/struts/apps/mailreader/Constants.java
 Tue Dec  6 13:12:43 2005
@@ -32,19 +32,37 @@
     /**
      * The package name for this application.
      */
-    public static final String PACKAGE = "org.apache.struts.webapp.example";
+    public static final String PACKAGE = "org.apache.struts.apps.mailreader";
 
 
     /**
-     * The token representing "failure" for this application.
+     * The token representing a "failure" result for this application.
      */
-    public static final String FAILURE = "failure";
+    public static final String FAILURE = "Failure";
 
 
     /**
-     * The token representing "success" for this application.
+     * The token representing a "logon" result for this application.
      */
-    public static final String SUCCESS = "success";
+    public static final String LOGON = "Logon";
+
+
+    /**
+     * The token representing a "success" result for this application.
+     */
+    public static final String SUCCESS = "Success";
+
+
+    /**
+     * The token representing the "action" parameter for this application.
+     */
+    public static final String ACTION = "action";
+
+
+    /**
+     * The token representing a "create" action.
+     */
+    public static final String CREATE = "Create";
 
 
     /**
@@ -88,4 +106,21 @@
      */
     public static final String ERROR_KEY = "ERROR";
 
+
+    /**
+     * The message to log when forwarding to a 'logon' result.
+     */
+    public static final String LOG_LOGON = " Forwarding to 'logon' result";
+
+    /**
+     * The message to log when forwarding to a 'failure' result.
+     */
+    public static final String LOG_FAILURE = " Forwarding to 'failure' result";
+
+    /**
+     * The message to log when forwarding to a 'success' result.
+     */
+    public static final String LOG_SUCCESS = " Forwarding to 'success' result";
+
+    
 }

Modified: 
struts/apps/trunk/mailreader/src/java/org/apache/struts/apps/mailreader/actions/BaseAction.java
URL: 
http://svn.apache.org/viewcvs/struts/apps/trunk/mailreader/src/java/org/apache/struts/apps/mailreader/actions/BaseAction.java?rev=354559&r1=354558&r2=354559&view=diff
==============================================================================
--- 
struts/apps/trunk/mailreader/src/java/org/apache/struts/apps/mailreader/actions/BaseAction.java
 (original)
+++ 
struts/apps/trunk/mailreader/src/java/org/apache/struts/apps/mailreader/actions/BaseAction.java
 Tue Dec  6 13:12:43 2005
@@ -19,6 +19,7 @@
 package org.apache.struts.apps.mailreader.actions;
 
 import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpSession;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -27,6 +28,7 @@
 import org.apache.struts.action.ActionMapping;
 import org.apache.struts.apps.mailreader.Constants;
 import org.apache.struts.apps.mailreader.dao.UserDatabase;
+import org.apache.struts.apps.mailreader.dao.User;
 
 /**
  * Base Action for MailReader application.
@@ -62,9 +64,25 @@
      * @return Return the mapping named "failure" or null if there is no such 
mapping.
      */
     protected ActionForward findFailure(ActionMapping mapping) {
+        if (log.isTraceEnabled()) {
+            log.trace(Constants.LOG_FAILURE);
+        }
         return (mapping.findForward(Constants.FAILURE));
     }
 
+    /**
+     * Return the local or global forward named "logon"
+     * or null if there is no such forward.
+     * @param mapping Our ActionMapping
+     * @return Return the mapping named "logon" or null if there is no such 
mapping.
+     */
+    protected ActionForward findLogon(ActionMapping mapping, HttpSession 
session) {
+        if (log.isTraceEnabled()) {
+            log.trace(" User is not logged on in session " + session.getId());
+            log.trace(Constants.LOG_LOGON);
+        }
+        return (mapping.findForward(Constants.LOGON));
+    }
 
     /**
      * Return the mapping labeled "success"
@@ -73,7 +91,29 @@
      * @return Return the mapping named "success" or null if there is no such 
mapping.
      */
     protected ActionForward findSuccess(ActionMapping mapping) {
+        if (log.isTraceEnabled()) {
+            log.trace(Constants.LOG_SUCCESS);
+        }
         return (mapping.findForward(Constants.SUCCESS));
+    }
+
+
+    /**
+     * If the user is not logged in,
+     * return the "logon" mapping.
+     * @param mapping Our ActionMappings
+     * @param session Our HttpSession
+     * @return Null if user is logged in, otherwise the "logon" forward.
+     */
+    protected ActionForward isUserLoggedOn(ActionMapping mapping, HttpSession 
session) {
+        User user = (User) session.getAttribute(Constants.USER_KEY);
+        if (user == null) {
+            if (log.isTraceEnabled()) {
+                log.trace(" User is not logged on in session " + 
session.getId());
+            }
+            return (mapping.findForward(Constants.LOGON));
+        }
+        return null;
     }
 
 }

Modified: 
struts/apps/trunk/mailreader/src/java/org/apache/struts/apps/mailreader/actions/EditRegistrationAction.java
URL: 
http://svn.apache.org/viewcvs/struts/apps/trunk/mailreader/src/java/org/apache/struts/apps/mailreader/actions/EditRegistrationAction.java?rev=354559&r1=354558&r2=354559&view=diff
==============================================================================
--- 
struts/apps/trunk/mailreader/src/java/org/apache/struts/apps/mailreader/actions/EditRegistrationAction.java
 (original)
+++ 
struts/apps/trunk/mailreader/src/java/org/apache/struts/apps/mailreader/actions/EditRegistrationAction.java
 Tue Dec  6 13:12:43 2005
@@ -26,9 +26,6 @@
 import javax.servlet.http.HttpSession;
 
 import org.apache.commons.beanutils.PropertyUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.struts.action.Action;
 import org.apache.struts.action.ActionForm;
 import org.apache.struts.action.ActionForward;
 import org.apache.struts.action.ActionMapping;
@@ -43,14 +40,7 @@
  *
  * @version $Rev$ $Date$
  */
-public final class EditRegistrationAction extends Action {
-
-    // ----------------------------------------------------- Instance Variables
-
-    /**
-     * The <code>Log</code> instance for this application.
-     */
-    private Log log = LogFactory.getLog("org.apache.struts.webapp.Example");
+public final class EditRegistrationAction extends BaseAction {
 
     // --------------------------------------------------------- Public Methods
 
@@ -64,9 +54,9 @@
 
         // Extract attributes we will need
         HttpSession session = request.getSession();
-        String action = request.getParameter("action");
+        String action = request.getParameter(Constants.ACTION);
         if (action == null) {
-            action = "Create";
+            action = Constants.CREATE;
         }
         
         if (log.isDebugEnabled()) {
@@ -75,14 +65,10 @@
 
         // Is there a currently logged on user?
         User user = null;
-        if (!"Create".equals(action)) {
+        if (!Constants.CREATE.equals(action)) {
             user = (User) session.getAttribute(Constants.USER_KEY);
             if (user == null) {
-                if (log.isDebugEnabled()) {
-                    log.debug(
-                        " User is not logged on in session " + 
session.getId());
-                }
-                return (mapping.findForward("logon"));
+                return findLogon(mapping,session);
             }
         }
 
@@ -111,19 +97,12 @@
             }
         }
 
-        // Set a transactional control token to prevent double posting
         if (log.isTraceEnabled()) {
             log.trace(" Setting transactional control token");
         }
-        
         saveToken(request);
 
-        // Forward control to the edit user registration page
-        if (log.isTraceEnabled()) {
-            log.trace(" Forwarding to 'success' page");
-        }
-        
-        return (mapping.findForward("success"));
+        return findSuccess(mapping);
 
     }
 

Modified: 
struts/apps/trunk/mailreader/src/java/org/apache/struts/apps/mailreader/actions/EditSubscriptionAction.java
URL: 
http://svn.apache.org/viewcvs/struts/apps/trunk/mailreader/src/java/org/apache/struts/apps/mailreader/actions/EditSubscriptionAction.java?rev=354559&r1=354558&r2=354559&view=diff
==============================================================================
--- 
struts/apps/trunk/mailreader/src/java/org/apache/struts/apps/mailreader/actions/EditSubscriptionAction.java
 (original)
+++ 
struts/apps/trunk/mailreader/src/java/org/apache/struts/apps/mailreader/actions/EditSubscriptionAction.java
 Tue Dec  6 13:12:43 2005
@@ -26,9 +26,6 @@
 import javax.servlet.http.HttpSession;
 
 import org.apache.commons.beanutils.PropertyUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.struts.action.Action;
 import org.apache.struts.action.ActionForm;
 import org.apache.struts.action.ActionForward;
 import org.apache.struts.action.ActionMapping;
@@ -43,14 +40,7 @@
  *
  * @version $Rev$ $Date$
  */
-public final class EditSubscriptionAction extends Action {
-
-    // ----------------------------------------------------- Instance Variables
-
-    /**
-     * The <code>Log</code> instance for this application.
-     */
-    private Log log = LogFactory.getLog("org.apache.struts.webapp.Example");
+public final class EditSubscriptionAction extends BaseAction {
 
     // --------------------------------------------------------- Public Methods
 
@@ -64,9 +54,9 @@
 
         // Extract attributes we will need
         HttpSession session = request.getSession();
-        String action = request.getParameter("action");
+        String action = request.getParameter(Constants.ACTION);
         if (action == null) {
-            action = "Create";
+            action = Constants.CREATE;
         }
         
         String host = request.getParameter("host");
@@ -75,19 +65,28 @@
         }
 
         // Is there a currently logged on user?
-        User user = (User) session.getAttribute(Constants.USER_KEY);
-        if (user == null) {
-            if (log.isTraceEnabled()) {
-                log.trace(" User is not logged on in session " + 
session.getId());
-            }
-            return (mapping.findForward("logon"));
+        User user = null;
+        if (!Constants.CREATE.equals(action)) {
+             user = (User) session.getAttribute(Constants.USER_KEY);
+             if (user == null) {
+                 if (log.isDebugEnabled()) {
+                     log.debug(
+                         " User is not logged on in session " + 
session.getId());
+                 }
+                 return (mapping.findForward(Constants.LOGON));
+             }
         }
 
         // Identify the relevant subscription
-        Subscription subscription =
-            user.findSubscription(request.getParameter("host"));
-            
-        if ((subscription == null) && !action.equals("Create")) {
+        Subscription subscription;
+        try {
+            subscription = user.findSubscription(host);
+        }
+        catch (NullPointerException e) {
+            subscription = null;
+        }
+
+        if ((subscription == null) && !action.equals(Constants.CREATE)) {
             if (log.isTraceEnabled()) {
                 log.trace(
                     " No subscription for user "
@@ -96,7 +95,7 @@
                         + host);
             }
             
-            return (mapping.findForward("failure"));
+            return findFailure(mapping);
         }
         
         if (subscription != null) {
@@ -105,7 +104,7 @@
 
         SubscriptionForm subform = (SubscriptionForm) form;
         subform.setAction(action);
-        if (!action.equals("Create")) {
+        if (!action.equals(Constants.CREATE)) {
             if (log.isTraceEnabled()) {
                 log.trace(" Populating form from " + subscription);
             }
@@ -127,12 +126,7 @@
             }
         }
 
-        // Forward control to the edit subscription page
-        if (log.isTraceEnabled()) {
-            log.trace(" Forwarding to 'success' page");
-        }
-        
-        return (mapping.findForward("success"));
+        return findSuccess(mapping);
 
     }
 

Modified: 
struts/apps/trunk/mailreader/src/java/org/apache/struts/apps/mailreader/actions/LogoffAction.java
URL: 
http://svn.apache.org/viewcvs/struts/apps/trunk/mailreader/src/java/org/apache/struts/apps/mailreader/actions/LogoffAction.java?rev=354559&r1=354558&r2=354559&view=diff
==============================================================================
--- 
struts/apps/trunk/mailreader/src/java/org/apache/struts/apps/mailreader/actions/LogoffAction.java
 (original)
+++ 
struts/apps/trunk/mailreader/src/java/org/apache/struts/apps/mailreader/actions/LogoffAction.java
 Tue Dec  6 13:12:43 2005
@@ -22,9 +22,6 @@
 import javax.servlet.http.HttpServletResponse;
 import javax.servlet.http.HttpSession;
 
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.struts.action.Action;
 import org.apache.struts.action.ActionForm;
 import org.apache.struts.action.ActionForward;
 import org.apache.struts.action.ActionMapping;
@@ -37,14 +34,7 @@
  *
  * @version $Rev$ $Date$
  */
-public final class LogoffAction extends Action {
-
-    // ----------------------------------------------------- Instance Variables
-
-    /**
-     * The <code>Log</code> instance for this application.
-     */
-    private Log log = LogFactory.getLog("org.apache.struts.webapp.Example");
+public final class LogoffAction extends BaseAction {
 
     // --------------------------------------------------------- Public Methods
 
@@ -79,8 +69,7 @@
         session.removeAttribute(Constants.USER_KEY);
         session.invalidate();
 
-        // Forward control to the specified success URI
-        return (mapping.findForward("success"));
+        return findSuccess(mapping);
 
     }
 

Modified: 
struts/apps/trunk/mailreader/src/java/org/apache/struts/apps/mailreader/actions/LogonAction.java
URL: 
http://svn.apache.org/viewcvs/struts/apps/trunk/mailreader/src/java/org/apache/struts/apps/mailreader/actions/LogonAction.java?rev=354559&r1=354558&r2=354559&view=diff
==============================================================================
--- 
struts/apps/trunk/mailreader/src/java/org/apache/struts/apps/mailreader/actions/LogonAction.java
 (original)
+++ 
struts/apps/trunk/mailreader/src/java/org/apache/struts/apps/mailreader/actions/LogonAction.java
 Tue Dec  6 13:12:43 2005
@@ -150,12 +150,9 @@
             return (mapping.getInputForward());
         }
 
-        // Save user object
         SaveUser(request,user);
 
-
-        // Otherwise, return "success"
-        return (findSuccess(mapping));
+        return findSuccess(mapping);
 
     }
 

Modified: 
struts/apps/trunk/mailreader/src/java/org/apache/struts/apps/mailreader/actions/SaveRegistrationAction.java
URL: 
http://svn.apache.org/viewcvs/struts/apps/trunk/mailreader/src/java/org/apache/struts/apps/mailreader/actions/SaveRegistrationAction.java?rev=354559&r1=354558&r2=354559&view=diff
==============================================================================
--- 
struts/apps/trunk/mailreader/src/java/org/apache/struts/apps/mailreader/actions/SaveRegistrationAction.java
 (original)
+++ 
struts/apps/trunk/mailreader/src/java/org/apache/struts/apps/mailreader/actions/SaveRegistrationAction.java
 Tue Dec  6 13:12:43 2005
@@ -26,9 +26,6 @@
 import javax.servlet.http.HttpSession;
 
 import org.apache.commons.beanutils.PropertyUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.struts.action.Action;
 import org.apache.struts.action.ActionForm;
 import org.apache.struts.action.ActionForward;
 import org.apache.struts.action.ActionMapping;
@@ -47,14 +44,7 @@
  * @version $Rev$ $Date$
  */
 
-public final class SaveRegistrationAction extends Action {
-
-    // ----------------------------------------------------- Instance Variables
-
-    /**
-     * The <code>Log</code> instance for this application.
-     */
-    private Log log = LogFactory.getLog("org.apache.struts.webapp.Example");
+public final class SaveRegistrationAction extends BaseAction {
 
     // --------------------------------------------------------- Public Methods
 
@@ -71,7 +61,7 @@
         RegistrationForm regform = (RegistrationForm) form;
         String action = regform.getAction();
         if (action == null) {
-            action = "Create";
+            action = Constants.CREATE;
         }
         
         UserDatabase database =
@@ -84,11 +74,8 @@
 
         // Is there a currently logged on user (unless creating)?
         User user = (User) session.getAttribute(Constants.USER_KEY);
-        if (!"Create".equals(action) && (user == null)) {
-            if (log.isTraceEnabled()) {
-                log.trace(" User is not logged on in session " + 
session.getId());
-            }
-            return (mapping.findForward("logon"));
+        if (!Constants.CREATE.equals(action) && (user == null)) {
+            return findLogon(mapping,session);
         }
 
         // Was this transaction cancelled?
@@ -97,7 +84,7 @@
                 log.trace(" Transaction '" + action + "' was cancelled");
             }
             session.removeAttribute(Constants.SUBSCRIPTION_KEY);
-            return (mapping.findForward("success"));
+            return findSuccess(mapping);
         }
 
         // Validate the transactional control token
@@ -119,15 +106,15 @@
             log.trace(" Performing extra validations");
         }
         
-        String value = null;
+        String value;
         value = regform.getUsername();
-        if (("Create".equals(action)) && (database.findUser(value) != null)) {
+        if ((Constants.CREATE.equals(action)) && (database.findUser(value) != 
null)) {
             errors.add(
                 "username",
                 new ActionMessage("error.username.unique", 
regform.getUsername()));
         }
         
-        if ("Create".equals(action)) {
+        if (Constants.CREATE.equals(action)) {
             value = regform.getPassword();
             if ((value == null) || (value.length() < 1)) {
                 errors.add("password", new 
ActionMessage("error.password.required"));
@@ -151,7 +138,7 @@
 
         // Update the user's persistent profile information
         try {
-            if ("Create".equals(action)) {
+            if (Constants.CREATE.equals(action)) {
                 user = database.createUser(regform.getUsername());
             }
             
@@ -184,7 +171,7 @@
         }
 
         // Log the user in if appropriate
-        if ("Create".equals(action)) {
+        if (Constants.CREATE.equals(action)) {
             session.setAttribute(Constants.USER_KEY, user);
             if (log.isTraceEnabled()) {
                 log.trace(
@@ -203,12 +190,7 @@
                 session.removeAttribute(mapping.getAttribute());
         }
 
-        // Forward control to the specified success URI
-        if (log.isTraceEnabled()) {
-            log.trace(" Forwarding to success page");
-        }
-        
-        return (mapping.findForward("success"));
+        return findSuccess(mapping);
 
     }
 

Modified: 
struts/apps/trunk/mailreader/src/java/org/apache/struts/apps/mailreader/actions/SaveSubscriptionAction.java
URL: 
http://svn.apache.org/viewcvs/struts/apps/trunk/mailreader/src/java/org/apache/struts/apps/mailreader/actions/SaveSubscriptionAction.java?rev=354559&r1=354558&r2=354559&view=diff
==============================================================================
--- 
struts/apps/trunk/mailreader/src/java/org/apache/struts/apps/mailreader/actions/SaveSubscriptionAction.java
 (original)
+++ 
struts/apps/trunk/mailreader/src/java/org/apache/struts/apps/mailreader/actions/SaveSubscriptionAction.java
 Tue Dec  6 13:12:43 2005
@@ -46,14 +46,7 @@
  * @version $Rev$ $Date$
  */
 
-public final class SaveSubscriptionAction extends Action {
-
-    // ----------------------------------------------------- Instance Variables
-
-    /**
-     * The <code>Log</code> instance for this application.
-     */
-    private Log log = LogFactory.getLog("org.apache.struts.webapp.Example");
+public final class SaveSubscriptionAction extends BaseAction {
 
     // --------------------------------------------------------- Public Methods
 
@@ -80,10 +73,7 @@
         // Is there a currently logged on user?
         User user = (User) session.getAttribute(Constants.USER_KEY);
         if (user == null) {
-            if (log.isTraceEnabled()) {
-                log.trace(" User is not logged on in session " + 
session.getId());
-            }
-            return (mapping.findForward("logon"));
+            return findLogon(mapping,session);
         }
 
         // Was this transaction cancelled?
@@ -92,13 +82,13 @@
                 log.trace(" Transaction '" + action + "' was cancelled");
             }
             session.removeAttribute(Constants.SUBSCRIPTION_KEY);
-            return (mapping.findForward("success"));
+            return findSuccess(mapping);
         }
 
         // Is there a related Subscription object?
         Subscription subscription =
             (Subscription) session.getAttribute(Constants.SUBSCRIPTION_KEY);
-        if ("Create".equals(action)) {
+        if (Constants.CREATE.equals(action)) {
             subscription = 
user.createSubscription(request.getParameter("host"));
         }
         if (subscription == null) {
@@ -132,7 +122,7 @@
             } catch (Exception e) {
                 log.error("Database save", e);
             }
-            return (mapping.findForward("success"));
+            return findSuccess(mapping);
         }
 
         // All required validations were done by the form itself
@@ -172,11 +162,7 @@
         }
         session.removeAttribute(Constants.SUBSCRIPTION_KEY);
 
-        // Forward control to the specified success URI
-        if (log.isTraceEnabled()) {
-            log.trace(" Forwarding to success page");
-        }
-        return (mapping.findForward("success"));
+        return findSuccess(mapping);
 
     }
 

Modified: struts/apps/trunk/mailreader/src/webapp/Logon.jsp
URL: 
http://svn.apache.org/viewcvs/struts/apps/trunk/mailreader/src/webapp/Logon.jsp?rev=354559&r1=354558&r2=354559&view=diff
==============================================================================
--- struts/apps/trunk/mailreader/src/webapp/Logon.jsp (original)
+++ struts/apps/trunk/mailreader/src/webapp/Logon.jsp Tue Dec  6 13:12:43 2005
@@ -49,8 +49,8 @@
 <html:javascript formName="LogonForm"
         dynamicJavascript="true"
          staticJavascript="false"/>
-<script language="Javascript1.1" src="staticJavascript.jsp"></script>
+<script language="Javascript1.1" src="StaticJavascript.jsp"></script>
 
-<jsp:include page="footer.jsp" />
+<jsp:include page="Footer.jsp" />
 </body>
 </html>

Modified: struts/apps/trunk/mailreader/src/webapp/MainMenu.jsp
URL: 
http://svn.apache.org/viewcvs/struts/apps/trunk/mailreader/src/webapp/MainMenu.jsp?rev=354559&r1=354558&r2=354559&view=diff
==============================================================================
--- struts/apps/trunk/mailreader/src/webapp/MainMenu.jsp (original)
+++ struts/apps/trunk/mailreader/src/webapp/MainMenu.jsp Tue Dec  6 13:12:43 
2005
@@ -12,7 +12,7 @@
 <h3><bean:message key="mainMenu.heading"/> <bean:write name="user" 
property="fullName" /></h3>
 <ul>
 <li><html:link action="/EditRegistration?action=Edit"><bean:message 
key="mainMenu.registration"/></html:link></li>
-<li><html:link forward="logoff"><bean:message 
key="mainMenu.logoff"/></html:link></li>
+<li><html:link forward="Logoff"><bean:message 
key="mainMenu.logoff"/></html:link></li>
 </ul>
 </body>
 </html>

Modified: struts/apps/trunk/mailreader/src/webapp/Registration.jsp
URL: 
http://svn.apache.org/viewcvs/struts/apps/trunk/mailreader/src/webapp/Registration.jsp?rev=354559&r1=354558&r2=354559&view=diff
==============================================================================
--- struts/apps/trunk/mailreader/src/webapp/Registration.jsp (original)
+++ struts/apps/trunk/mailreader/src/webapp/Registration.jsp Tue Dec  6 
13:12:43 2005
@@ -179,8 +179,8 @@
 <html:javascript formName="RegistrationForm"
         dynamicJavascript="true"
          staticJavascript="false"/>
-<script language="Javascript1.1" src="staticJavascript.jsp"></script>
+<script language="Javascript1.1" src="StaticJavascript.jsp"></script>
 
-<jsp:include page="footer.jsp" />
+<jsp:include page="Footer.jsp" />
 </body>
 </html:html>

Modified: struts/apps/trunk/mailreader/src/webapp/StaticJavascript.jsp
URL: 
http://svn.apache.org/viewcvs/struts/apps/trunk/mailreader/src/webapp/StaticJavascript.jsp?rev=354559&r1=354558&r2=354559&view=diff
==============================================================================
--- struts/apps/trunk/mailreader/src/webapp/StaticJavascript.jsp (original)
+++ struts/apps/trunk/mailreader/src/webapp/StaticJavascript.jsp Tue Dec  6 
13:12:43 2005
@@ -1,4 +1,4 @@
 <%@ page contentType="application/x-javascript" language="java" %>
 <%-- set document type to Javascript addresses a bug in Netscape according to 
a web resource --%>
 <%@ taglib uri="http://struts.apache.org/tags-html"; prefix="html" %>
-<html:javascript dynamicJavascript="false" staticJavascript="true"/>
+<html:javascript dynamicJavascript="false" staticJavascript="true" />

Modified: 
struts/apps/trunk/mailreader/src/webapp/WEB-INF/struts-config-registration.xml
URL: 
http://svn.apache.org/viewcvs/struts/apps/trunk/mailreader/src/webapp/WEB-INF/struts-config-registration.xml?rev=354559&r1=354558&r2=354559&view=diff
==============================================================================
--- 
struts/apps/trunk/mailreader/src/webapp/WEB-INF/struts-config-registration.xml 
(original)
+++ 
struts/apps/trunk/mailreader/src/webapp/WEB-INF/struts-config-registration.xml 
Tue Dec  6 13:12:43 2005
@@ -55,7 +55,7 @@
                name="{1}Form"
               scope="request"
            validate="false">
-      <forward name="success"              path="/{1}.jsp"/>
+      <forward name="Success"              path="/{1}.jsp"/>
     </action>
 
     <!-- Matches all save actions (in this case, only user registration) -->

Modified: struts/apps/trunk/mailreader/src/webapp/WEB-INF/struts-config.xml
URL: 
http://svn.apache.org/viewcvs/struts/apps/trunk/mailreader/src/webapp/WEB-INF/struts-config.xml?rev=354559&r1=354558&r2=354559&view=diff
==============================================================================
--- struts/apps/trunk/mailreader/src/webapp/WEB-INF/struts-config.xml (original)
+++ struts/apps/trunk/mailreader/src/webapp/WEB-INF/struts-config.xml Tue Dec  
6 13:12:43 2005
@@ -49,10 +49,10 @@
 
   <!-- ========== Global Forward Definitions ============================== -->
   <global-forwards>
-    <forward   name="welcome"              path="/Welcome.do"/>
-    <forward   name="logoff"               path="/Logoff.do"/>
-    <forward   name="logon"                path="/Logon.do"/>
-    <forward   name="success"              path="/MainMenu.do"/>
+    <forward   name="Welcome"              path="/Welcome.do"/>
+    <forward   name="Logoff"               path="/Logoff.do"/>
+    <forward   name="Logon"                path="/Logon.do"/>
+    <forward   name="Success"              path="/MainMenu.do"/>
   </global-forwards>
 
 
@@ -62,34 +62,34 @@
       <!-- Display welcome page -->
       <action    path="/Welcome"
                  
type="org.apache.struts.apps.mailreader.actions.WelcomeAction">
-          <forward name="failure" path="/Error.jsp" />
-          <forward name="success" path="/welcome.jsp" />
+          <forward name="Failure" path="/Error.jsp" />
+          <forward name="Success" path="/Welcome.jsp" />
       </action>
 
       <!-- Change locale action -->
       <action
           path="/Locale"
           type="org.apache.struts.apps.mailreader.actions.LocaleAction"
-          parameter="welcome" />
+          parameter="Welcome" />
 
       <!-- Display registration page -->
       <action    path="/Registration"
-                 forward="/registration.jsp"/>
+                 forward="/Registration.jsp"/>
 
       <!-- Display logon page -->
       <action    path="/MainMenu"
-                 forward="/mainMenu.jsp"/>
+                 forward="/MainMenu.jsp"/>
 
       <!-- Display logon page -->
       <action    path="/Logon"
-                 forward="/logon.jsp"/>
+                 forward="/Logon.jsp"/>
 
        <!-- Process a user logon -->
        <action    path="/SubmitLogon"
                   type="org.apache.struts.apps.mailreader.actions.LogonAction"
                   name="LogonForm"
                  scope="request"
-                 input="logon">
+                 input="Logon">
          <exception
                    key="expired.password"
                   
type="org.apache.struts.apps.mailreader.dao.ExpiredPasswordException"
@@ -99,7 +99,7 @@
       <!-- Process a user logoff -->
        <action    path="/Logoff"
                   
type="org.apache.struts.apps.mailreader.actions.LogoffAction">
-         <forward name="success"              path="/Welcome.do"/>
+         <forward name="Success"              path="/Welcome.do"/>
        </action>
 
       <!-- Edit mail subscription -->
@@ -108,8 +108,8 @@
                  name="SubscriptionForm"
                 scope="request"
              validate="false">
-        <forward name="failure"              path="/MainMenu.do"/>
-        <forward name="success"              path="/subscription.jsp"/>
+        <forward name="Failure"              path="/MainMenu.do"/>
+        <forward name="Success"              path="/Subscription.jsp"/>
       </action>
 
        <!-- Save mail subscription -->
@@ -117,14 +117,14 @@
                   
type="org.apache.struts.apps.mailreader.actions.SaveSubscriptionAction"
                   name="SubscriptionForm"
                  scope="request"
-                 input="subscription">
-         <forward name="subscription"    path="/subscription.jsp"/>
-         <forward name="success"         
path="/EditRegistration.do?action=Edit"/>
+                 input="Subscription">
+         <forward name="Subscription"    path="/Subscription.jsp"/>
+         <forward name="Success"         
path="/EditRegistration.do?action=Edit"/>
        </action>
 
       <!-- Display the change password page when a password expires -->
       <action    path="/ExpiredPassword"
-              forward="/changePassword.jsp">
+              forward="/ChangePassword.jsp">
       </action>
 
       <!-- Display the "walking tour" documentation -->

Modified: struts/apps/trunk/mailreader/src/webapp/WEB-INF/webtest.xml
URL: 
http://svn.apache.org/viewcvs/struts/apps/trunk/mailreader/src/webapp/WEB-INF/webtest.xml?rev=354559&r1=354558&r2=354559&view=diff
==============================================================================
--- struts/apps/trunk/mailreader/src/webapp/WEB-INF/webtest.xml (original)
+++ struts/apps/trunk/mailreader/src/webapp/WEB-INF/webtest.xml Tue Dec  6 
13:12:43 2005
@@ -128,7 +128,7 @@
     </target>
 
     <target name="default" description="Can be run anytime"
-            depends="Browse,Logon" />
+            depends="Browse" />
 
     <target name="Browse"
             description=" Visitors can browse the Welcome, Login, and Register

Modified: struts/apps/trunk/mailreader/src/webapp/tour.html
URL: 
http://svn.apache.org/viewcvs/struts/apps/trunk/mailreader/src/webapp/tour.html?rev=354559&r1=354558&r2=354559&view=diff
==============================================================================
--- struts/apps/trunk/mailreader/src/webapp/tour.html (original)
+++ struts/apps/trunk/mailreader/src/webapp/tour.html Tue Dec  6 13:12:43 2005
@@ -36,15 +36,11 @@
                This article assumes the reader has a basic understanding of 
the Java language, 
                JavaBeans, web applications, and JavaServer Pages. For 
background on these 
                technologies, see the 
-               <a href="http://struts.apache.org/userGuide/preface.html";>
+               <a 
href="http://struts.apache.org/struts-action/userGuide/preface.html";>
                        Preface to the Struts User Guide</a>.
        </i>
     </p>
-    
-    NOTE - 
-    The content below is extremely out of date and should be ignored until 
someone finds
-    the time and concern to completely rewrite this tour.
-    
+
     <hr />
 
     <ul>
@@ -112,14 +108,16 @@
     </ul>
     <hr />
 
-    <p>The Struts distribution bundles four applications: 
struts-documentation, tiles-documentation, struts-example, and struts-examples. 
This document walks through the struts-example, also known as the "MailReader 
Demonstration Application".</p>
+    <p>The Struts App subproject includes four applications: struts-blank, 
struts-cookbook, struts-examples, and struts-mailreader. This document walks 
through struts-mailreader, also known as the "MailReader Demonstration 
Application".</p>
 
     <p>The premise of the MailReader is that it is the first iteration of a 
portal application. This version allows users to register themselves and 
maintain a set of accounts with various mail servers. When completed, the 
application would let users read mail from their accounts.</p>
 
-    <p>The MailReader application demonstrates registering with an 
application, logging into an application, maintaining a master record, and 
maintaining child records. This document walks through the JSP pages, Struts 
Java classes, and Struts configuration elements needed to do these things.</p>
+    <p>The MailReader application demonstrates registering with an 
application, logging into an application, maintaining a master record, and 
maintaining child records. This document walks through the JSP pages, Java 
classes, and configuration elements needed to do these things.</p>
+
+    <p>For more about the MailReader, including alternate implementations and 
a set of Use Cases, please visit the <a 
href="http://opensource2.atlassian.com/confluence/oss/display/STRUTS/MailReader";>Struts
 University MailReader area</a>.</p>
 
     <blockquote>
-      <p>Note that for compatability and ease of deployment, the MailReader 
uses "application-based" authorization. However, use of the standard Java 
Authentication and Authorization Service (JAAS) is recommended for most 
applications. (See the <a 
href="http://jakarta.apache.org/struts/userGuide/preface.html";>Preface to the 
Struts User Guide</a> for more about authentification technologies.)</p>
+      <p>Note that for compatability and ease of deployment, the MailReader 
uses "application-based" authorization. However, use of the standard Java 
Authentication and Authorization Service (JAAS) is recommended for most 
applications. (See the <a 
href="http://struts.apache.org/struts-action/userGuide/preface.html";>Preface to 
the Struts User Guide</a> for more about authentification technologies.)</p>
     </blockquote>
 
     <p>The walkthrough starts with how the initial welcome page is displayed, 
and then steps through logging in, adding and editing subscriptions, and 
creating a new registration.</p>
@@ -134,7 +132,7 @@
       <p><font class="hint">"Link actions not pages."</font></p>
     </blockquote>
 
-    <p>Unfortunately, actions cannot be specified as a welcome page. Since 
there can be a list of pages, the web server looks for each page on the list 
before selecting one. The web server doesn't see actions as pages and will 
never select one as a welcome page. So, in the case of a welcome page, how do 
we follow the Struts best practice of navigating through actions rather than 
pages?</p>
+    <p>Unless you are using Java 1.5, actions cannot be specified as a welcome 
page. Since there can be a list of pages, the web server looks for each page on 
the list before selecting one. The web server doesn't see actions as pages and 
will never select one as a welcome page. So, in the case of a welcome page, how 
do we follow the Struts best practice of navigating through actions rather than 
pages?</p>
 
     <p>One solution is to use a server page to "bootstrap" a Struts action. A 
Java web application recognizes the idea of "forwarding" from one page to 
another page (or action). We can register the usual "index.jsp" as the welcome 
page and have it forward to a "Welcome" action. Here's the MailReader's 
index.jsp:</p>
     <hr />
@@ -144,9 +142,9 @@
 </pre>
     <hr />
 
-    <p>At the top of the page, we import the "struts-logic" JSP tag library. 
(Again, see the <a 
href="http://jakarta.apache.org/struts/userGuide/preface.html";>Preface to the 
Struts User Guide</a> for more about the technologies underlying Struts.) The 
page itself consists of a single tag that redirects to the "Welcome" action. 
The tag inserts the actual web address for the redirect when the page is 
rendered. But, where does the tag find the actual address to insert?</p>
+    <p>At the top of the page, we import the "struts-logic" JSP tag library. 
(For more about the Struts JSP tags, see the <a 
href="http://struts.apache.org/struts-taglib/";>Struts Taglib website</a>.) The 
page itself consists of a single tag that redirects to the "Welcome" action. 
The tag inserts the actual web address for the redirect when the page is 
rendered. But, where does the tag find the actual address to insert?</p>
 
-    <p>The list of actions, along with other Struts components, are registered 
through one or more Struts configuration files. The configuration files are 
written as XML documents and processed when the application starts. If we just 
wanted to forward to the welcome page, we could use a configuration element 
like this:</p>
+    <p>The list of actions, along with other components, are registered 
through one or more Struts Action configuration files. The configuration files 
are written as XML documents and processed when the application starts. If we 
just wanted to forward to the welcome page, we could use a configuration 
element like this:</p>
     <hr />
     <pre>
 <code>&lt;!-- Display welcome page --&gt;
@@ -163,14 +161,14 @@
     <pre>
 <code>&lt;!-- Display welcome page --&gt;
 &lt;action path="/Welcome"
-  type="org.apache.struts.webapp.example.WelcomeAction"&gt;
+  type="org.apache.struts.apps.mailreader.actions.WelcomeAction"&gt;
   &lt;forward name="failure" path="/Error.jsp" /&gt;
-  &lt;forward name="success" path="/welcome.jsp" /&gt;
+  &lt;forward name="success" path="/Welcome.jsp" /&gt;
 &lt;/action&gt;</code>
 </pre>
     <hr />
 
-    <p>Here, the "WelcomeAction" Java class executes whenever someone asks for 
the Welcome action. As it completes, the Action class can select which page is 
displayed. Two pages the class can select here are "Error.jsp" and 
"welcome.jsp". But the Action class doesn't need to know the path to the pages. 
The class can select them just using the names "success" or "failure".</p>
+    <p>Here, the "WelcomeAction" Java class executes whenever someone asks for 
the Welcome action. As it completes, the Action class can select which page is 
displayed. Two pages the class can select here are "Error.jsp" and 
"Welcome.jsp". But the Action class doesn't need to know the path to the pages. 
The class can select them just using the names "success" or "failure".</p>
 
     <p>OK ... but why would a WelcomeAction want to choose between success and 
failure?</p>
 
@@ -354,7 +352,7 @@
 &lt;html:javascript formName="LogonForm"
         dynamicJavascript="true"
          staticJavascript="false"/&gt;
-&lt;script language="Javascript1.1" 
src="staticJavascript.jsp"&gt;&lt;/script&gt;
+&lt;script language="Javascript1.1" 
src="StaticJavascript.jsp"&gt;&lt;/script&gt;
 
 &lt;jsp:include page="footer.jsp" /&gt;
 &lt;/body&gt;
@@ -592,7 +590,7 @@
 &lt;h3>&lt;bean:message key="mainMenu.heading"/> &lt;bean:write name="user" 
property="fullName" />&lt;/h3>
 &lt;ul>
 &lt;li>&lt;html:link action="/EditRegistration?action=Edit">&lt;bean:message 
key="mainMenu.registration"/>&lt;/html:link>&lt;/li>
-&lt;li>&lt;html:link forward="logoff">&lt;bean:message 
key="mainMenu.logoff"/>&lt;/html:link>&lt;/li>
+&lt;li>&lt;html:link forward="Logoff">&lt;bean:message 
key="mainMenu.logoff"/>&lt;/html:link>&lt;/li>
 &lt;/ul>
 &lt;/body>
 &lt;/html></blockquote></code></pre>



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

Reply via email to