From: <jm...@us...> - 2005-09-23 07:36:42
|
Update of /cvsroot/struts/struts-site/src/documentation/content/xdocs/strutsdialogs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31820/src/documentation/content/xdocs/strutsdialogs Modified Files: mailreader-registration.xml Log Message: Index: mailreader-registration.xml =================================================================== RCS file: /cvsroot/struts/struts-site/src/documentation/content/xdocs/strutsdialogs/mailreader-registration.xml,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** mailreader-registration.xml 23 Sep 2005 07:23:42 -0000 1.1 --- mailreader-registration.xml 23 Sep 2005 07:36:34 -0000 1.2 *************** *** 3,7 **** <document> <header> ! <title>Struts Dialogs Mail Reader: Subscriptions</title> </header> --- 3,7 ---- <document> <header> ! <title>Struts Dialogs Mail Reader: Registration</title> </header> *************** *** 10,144 **** <section id="overview"> <title>Overview</title> ! <p><strong>Subscriptions</strong> component performs the following functions:</p> ! <ul> ! <li>Displays a list of email subscriptions</li> ! <li>Allows to create a new sibscription</li> ! <li>Allows to update existing subscription</li> ! </ul> ! <p>Subscriptions component is controlled by one action (SubscriptionAction.java) ! and has two views: <code>subscriptions.jsp</code> and <code>subscription.jsp</code>.</p> ! ! <p><code>subscriptions.jsp</code> displays a list of email subscriptions. ! It is shown to a logged-in user, if there is no <em>current</em> subscription.</p> ! <figure src="images/mailreader-subscriptions.gif" alt="MailReader Subscriptions"/> ! <p/> ! <p>If current subscription exists, <code>subscription.jsp</code> displays it ! to a logged-in user. It can be either a new subscription...</p> ! <figure src="images/mailreader-subscription-create.gif" alt="MailReader Create Subscription"/> ! <p>...or an existing subscription:</p> ! <figure src="images/mailreader-subscription-update.gif" alt="MailReader Update Subscription"/> ! ! </section> ! ! <section id="subscriptionaction"> ! <title>SubscriptionAction.java</title> ! <p><code>SubscriptionAction</code> class does not differ much from standard ! all-in-one <link href="crudaction.html">CRUD Component</link>. The major difference ! is that Subscription action first verifies if a user is logged in. If not, ! it redirects to Login action. If user is logged in, then Subscription action ! handles input events in standard way for DialogAction class. In real application ! this code should be placed in an interceptor or servlet filter. Struts Chains, ! introduced in Struts 1.3, should allow easy implementation of generic interceptors ! like login interceptor.</p> ! <source> ! public class SubscriptionAction extends CRUDAction { ! ... ! public ActionForward execute(ActionMapping mapping, ! ActionForm form, ! HttpServletRequest request, ! HttpServletResponse response) ! throws Exception { ! ! // If user not found, redirect to login action ! HttpSession session = request.getSession(); ! if (session.getAttribute(Constants.USER_KEY) == null) { ! return mapping.findForward("logon"); ! } ! ! // User is valid, perform standard event processing ! return super.execute(mapping, form, request, response); ! } ! ... ! } ! </source> ! </section> ! ! <section id="subscriptionslist"> ! <title>Subscriptions list</title> ! <p>If <em>current</em> subscription does not exist, Subscrpiptions action displays ! subscrpiption list. This list can be split into pages. Default page size is four ! rows. Struts-EL is used to access actionform data.</p> ! <source> ! <table> ! <thead> ! <tr> ! <th>Host</th> ! <th>Username</th> ! <th>Server Type</th> ! <th >Auto</th> ! <th>Operation</th> ! </tr> ! </thead> ! ! <logic:present name="user" scope="session"> ! <!-- Show subscription list --> ! <logic-el:iterate id="subscription" ! collection="${SubscriptionForm.subscriptions}" ! offset="${SubscriptionForm.offset}" ! length="${SubscriptionForm.pagesize}" ! type="net.jspcontrols.mailreader.business.Subscription"> ! <tr> ! <td><c:out value="${subscription.host}"/></td> ! <td><c:out value="${subscription.username}"/></td> ! <td><c:out value="${subscription.type}"/></td> ! <td><c:out value="${subscription.autoConnect}"/></td> ! <td> ! <html-el:link ! href="Subscriptions.do?DIALOG-EVENT-UPDATE&host=${subscription.host}"> ! Edit ! </html-el:link> ! <html-el:link ! href="Subscriptions.do?DIALOG-EVENT-DELETE&host=${subscription.host}"> ! Delete ! </html-el:link> ! </td> ! </tr> ! </logic-el:iterate> ! </logic:present> ! </table> ! ! <html:form action="/Subscriptions.do"> ! <html:submit property="DIALOG-EVENT-CREATE" value="New Subscription"/> ! <html-el:submit property="DIALOG-EVENT-PREVPAGE" value="Previous Page" ! disabled="${SubscriptionForm.firstpage}"/> ! <html-el:submit property="DIALOG-EVENT-NEXTPAGE" value="Next Page" ! disabled="${SubscriptionForm.lastpage}"/> ! <html:submit property="DIALOG-EVENT-BACKHOME" value="Cancel"/> ! </html:form> ! </source> ! </section> ! ! <section id="subscription"> ! <title>Creating and updating subscriptions</title> ! <p>The major difference of this version of MailReader application from original ! Ted Husted's version is that action form has session scope and current subscription ! is nested within the action form. Fortunately, Subscrption business object (BO) ! has only String and boolean fields, so no conversion is needed and it is easy to ! retain invalid values in the form.</p> ! <p>When a user creates new subscription, a new <code>Subscription</code> object is created and ! nested in the <code>SubscriptionForm.java</code> class. If a user wants to update ! existing subscription, then it is cloned into a detached object, which in turn, is ! nested within <code>SubscriptionForm.java</code> class. Therefore, changes to ! nested subscription do not affect persistent data. If the user cancels the update ! process, then detached subscription is simply deleted from memory.</p> ! <p>Subscription action creates new or updates existing subscription based on input ! event generated by button on <code>subscriptions.jsp</code> page. DIALOG-EVENT-CREATE ! creates new subscription, DIALOG-EVENT-UPDATE selects a subscription as current and ! updates it.</p> ! </section> ! ! <section id="next"> ! <title>Next: Registration component</title> ! <p>Proceed to <link href="mailreader-registration.html">Registration</link> component.</p> </section> --- 10,14 ---- <section id="overview"> <title>Overview</title> ! <p>Under construction</p> </section> |