Design analysis of Struts example
Design and Analysis of the original author Struts example: Ted Husted translation: hatpdb 2003-8-25
Disclaimer: This is a framework example of how to create a struts application. This specification and details of the implementation are derived from one project. It may be very different from the project frames you do, but maybe some common. In order to write more projects and software, you can understand this title, including "Structural Analysis and System Description" (ISBN 0138543801), Steve McConnell (ISBN 1556154844). Example Application - Sample Description Problem Definition Solution Demand Analysis Core Task Other Requires Screen Flow Example Welcome Page Registration Page Land Menu item account account Description Exit page Product Select Application Interface -------------- -------------------------------------------------- ---------------- 1.0 Problem definitions Many people have a mail account on the mail server, but some people can't manage these multiple accounts very well. The login portal entry of a private and public mail server is usually only allowed to be able to log in. -------------------------------------------------- ------------------------------ 2.0 solution These issues can be solved by the landing program of the website. This program can allow users to register a series of mail accounts and account description information of any webmail server through the network, and can also re-see them. -------------------------------------------------- ------------------------------ 3. 0 Requirements Analysis 3.1 Core Tasks Use User Name and User Password to Register a new account by browse Log in to enter the registered account Add a mail account Description View a description of a mail account Exit Login 3.2 Additional Requirements Authorized Mail Server can create multiple accounts. The account information page cannot be displayed to the unauthorized user. In order to achieve a wide range of user groups, this program should be able to meet users using different languages. We should be able to modify the browsing page without recompiling the application. -------------------------------------------------- ------------------------------ 4.0 View Process 4.1 Welcome Page Register a new account {register} Login Already registered account {login } 4.2 Registration Displays the registration attribute form; Option: Save, reset, and cancel. Table Domain: Username, Password, Password (Confirm), Full Name, from address (confirm), reply to address. Save: Verify form attributes; return to the user's suggestion or store the display of the successful menu verification: Password and Repeat password must be Compliance; the source of the message and the reply address must comply with the writing rules of the email address (must contain @ symbols), the reply address is optional, and the other can't be empty, but also in line with other validation rules, the username must be unique. If the registration is successful: {menu} If the registration failed: {register} Reset: Restore the content Cancel: Jump to {login.} 4.3 Login to the login user display form information, and you can choose "save" or "heavy" "Operation". Form: Username, user password (Password). Save: Verify that login information, both of which must be, and must be the same as the information at the time of registration (case sensitive).
Cancel: Cancel Edit 4.4 Main menu Add / edit (add / edit) account description {account}. Exit {Welcome}. 4.5 Account display form Edit User Registration Information (see Register view). The list shows the description of the account; the option "Edit" or "Remove" account description information {subscription}. The list must contain the host name and other attribute (if there is extra space) Select "Add" (add) new account description Information {Subscription}. 4.6 Account Description Information - Add (Add), Edit (Edit), Delete Display Account Description Property Form; Option Operation "Add", "Edit", "Delete" (Add, Edit, DELETE). Optional "Add" (Add), Edit "(Edit) Perform Tasks: Save, Reset, Cancel (Save, RESET, CANCEL). Optional "Delete" Perform Tasks: "Confirm", "Cancel". Table Single Field: Mail Server, Mail Server, Mail Server Type. Save: Verify the account description attribute; return to the user's suggestion or display the updated account . Verify form: Auto connection may return to empty (false), all other properties must be non-empty. If saved success: {account}. If save fails: {subscription}. Reset: Cancel Edit. Cancel: Returns the {Account} view. Confirmation (delete): Confirm Delete Record; Display Update Information {Accent.}. 4.7 Exit Let the user's login information failed; return to the welcome page. -------------------------------------------------- ------------------------------ 5. 0 Product Choose We choose Java's Struts framework to implement this project. Its designs are described as writing easy, scalable web applications; due to the MVC mode, make the application easy to maintain; use JSP to implement the display section, all modifications do not need to recompilate the program; support users through web programs Custom operation; support international apps.
-------------------------------------------------- ------------------------------ 6.0 Application Interface 6.1 Properties Tag Composition Properties Type Rule Domain Domain Username UserName String! Null Unique password User password String null Full Name User fullname String null From AddressUser fromAddress String null * @ * Reply To AddressUser replyToAddress String -!!!!! User subscriptions Hashtable Mail ServerSubscription host String null unique Mail UsernameSubscription username String null Mail password Subscription password String! Null Mail Server Type Subscription Type String "IMAP", "POP3" Password (REPEAT) RegistrationForm Password2 String! Null --------------------------- -------------------------------------------------- --- 6. 3 Form Beans
Please refer to the LinkUser user-defined tag. Edit account description information link to "EditSubscription.do?Action=edit" {Host} "UserName = Username Host = Mail Server Let change and submit to" Savess Proption.do " Use the hidden form field: "Action = Edit", please refer to the LinkSubscription custom label. Delete account description information links to "EditSubscription.do?action=delete&username= = delement=@t}" username = username host = mail server allows the user to confirm whether it is deleted, if deleted submit to action = "SaveSubscription.do" hidden Table field: "Action = Delete" Please refer to the LinkSubscription custom label. Exit Link to the "/logf.do" page is not allowed to display unauthorized users. Please refer to the Checklogin custom label.
-------------------------------------------------- ------------------------------ 6.4.1 Action Configuration (Actual Configuration)
Forward name = "success" Path = "/ index.jsp" /> action> action-mapings> ------------------------ -------------------------------------------------- ------ 6.3 Custom Label 6.3.1 Application Tag This application uses the following custom label with "app" as the log name: App Tab - <% @ Taglib URI = "/ Web-INF / APP. TLD "prefix ="%> tag name Description Checklogin Check if there is a legal user login to enter the current session, if no user's session information will jump to the landing page. Linkuser generates a URL encoding pair path, including the user-selected query parameters. Linksubscription generates a URL encoding pair path, including the user-selected query parameters.
-------------------------------------------------- ------------------------------ CHECKLOGIN Attribute Name Description No Properties -------------- -------------------------------------------------- --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- : User named "user": ------------------- -------------------------------------------------- ------- LinkSubscription Attribute Name Description Page User's Action Description Value, for example: "/ edsubscription.do?action=edit". Package household's action description value and user account information to the request path, for example : User name "User" and description account is "mail.yahoo.com": --- -------------------------------------------------- --------------------------- 6.3.2 Struts Custom Label This application uses the following struts defined tag libraries and description name: bean tags - <% @ Taglib URI = "/ Web-inf / struts-bean.tld" prefix = "bean"%> html tags - <% @ Taglib URI = "/ Web-inf / struts-html.tld" prefix = " HTML "%> Logic Tags - <% @ Taglib URI =" / Web-inf / struts-logic.tld "pref IX = "Logic"%> ----------------------------------------- ------------------------------------- 6.4 Fault action page component action index.jsp None Page = "/ editregistration.do?action=create"page="/logon.jsp" logon.jsp logonform action = "logon.do" mainmenu.jsp user (session) Page = / EditRegistration.do? action = Edit "Page = "/ logoff.do" registration.jsp User (session) registrationform action = "saveregistration.do" Page =