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 Requirements Screen Example Welcome Page Registration Page Land Menu item Account Account Description Exit Page Product Selection Application Interface
-------------------------------------------------- ------------------------------
1.0 Issues Definition Many people have a mail account on the mail server, but some people cannot 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 login 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 Demand Analysis 3.1 Core Task Use User Name and User Password Register a new account to log in to the already registered account to add a mail account account Description View a mail account Description Exit Landing 3.2 Other requirements Authorized mail server can be created Account. 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 Display Registration Properties 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" Execute Tasks: "Confirm", "Cancel" (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 Select We select the 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 Programming Interface 6.1 Properties tab of the component property type rules Domain Domain Username User 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
form-beans>
-------------------------------------------------- ------------------------------
6.4 Action Mappings 6.4.1 Core Perform Task Mapping example Create an account according to the username and password Link to "EditRegistration.do?action=create" submit form to "Actoin = SAVEREGISTRATION.DO" log information to the account
Open "Login.jsp" - Enter the information file to "login.do" Submit the input form from "Action =" Logon.do "Add a mail account description information
Link to "/EditSubscription.do?action=create&user={}" UserName = Username Submit Enterprise Form to "Action =" SAVESUBSCRIPTION.DO "Please refer to the linkUser user-defined tag. Edit account description information
Link to "EditSubscription.do?action=edit&username=}" UserName = username host = mail server let change and submit to "SaveSubscription.do" hidden form field: "Action = Edit" Please refer to LinkSubscription custom labels. 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. drop out
Link to the /logoff.do page is not allowed to display unauthorized users. Please refer to the Checklogin custom label.
-------------------------------------------------- ------------------------------
6.4.1 Action Configuration
<-! Edit mail subscription e-mail account edit description ->
action-mappings>
-------------------------------------------------- ------------------------------
6.3 Custom Label 6.3.1 Application Tag This application uses the following custom label with "app" as the marked name:
APP tag - <% @ Taglib URI = "/ Web-inf / app" prefix = "app"%>
Label Name Description Checklogin Checks if there is a legitimate user login to enter the current session, and if there is no user's session information, it 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 attribute
-------------------------------------------------- ----------------------------------------------------------------------------------- Action = create ". Package user account information to request path, for example: username" user ":
-------------------------------------------------- ------------------------------------------------------------------------------------------------------------------------------------------------- Action = Edit ". The action description value of the packaging household 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 names:
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" prefix = "logic"%>
-------------------------------------------------- ------------------------------
6.4 Fault Page Components 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 = "/ editSubscription.do?action=Delete"page="/editSubscription.do?action=Edit"page="/editSubscription.do?action=Create "subscription.jsp user (session) subscriptionform action =" SaveSubscription.do "
-------------------------------------------------- ------------------------------
6.5 International Refer to
The application uses this file to contain all error descriptions, text information. Other languages can be supported by translating this file.
The application will automatically select this property file to locate the language used by the user.