Chapter 9 Session
Contents A.Problem: Phone Book Searching B.Problem: Phone Book Management
A. Problem: Phone Book Searching Develop a Phone Book system. The phone book keeps many phone contact A phone contact including: name, phone number and address This phone book allows users search phone contact by name, phone number or address
Search by address
Solution 1.Developing the view 2.Developing the model 3.Developing the controller 4.View Search Result
1. Developing the view Page name: search_ui.jsp Page title: Phone Book Searching Table: Label “Search”; keywordTextBox; label “Search by”; searchBySelectBox, value: Name, Phone Number, Address; searchButton Table: No., Name, Phone Number, Address
keywordTextBox searchBySelectBox searchButton
2. Develop the model
3. Developing the controller
4. View Search Result
B. Problem: Phone Book Management Extend the Phone Book problem above so that it can be able to do the following tasks: View all of phone contacts Add a new phone contact Edit a phone contact Delete a phone contact
List all phone contacts Click “Add new contact”
Add a new phone contact Click “Truong Minh Ngoc”
Edit a phone contact
Delete a phone contact Click “Delete”
Search Phone Contact Click “Search”
Solution 1.Developing the view 2.Developing the model 3.Developing the controller
1. Developing the view The index.jsp page: searching and viewing all phone contacts The addedit_ui.jsp : adding new or editting a phone contact
Index.jsp Page title: Phone Book Table: Label “Search”; keywordTextBox; label “Search by”; searchBySelectBox, value: Contact Name, Phone Number, Contact Address; searchButton, value “Search” Table: No., Name, Phone Number, Address, Delete
Index.jsp
addedit_ui.jsp
Title: Phone Book Table: Label: Label “Contact Name”; nameTextBox Label “Phone Number”; phoneTextBox Label “Address” ; addressTextBox submitButton, value:
2. Developing the model 2.1. Edit PhoneContact class 2.2. Edit PhoneBook class 2.3. Add PhoneBookInstance class
2.1. PhoneContact
2.2. PhoneBook
2.3. PhoneBookInstance
3. Developing the controller 3.1. SearchPhoneContactServlet 3.2. AddEditPhoneContactServlet 3.3. DeletePhoneContactServlet
3.1. SearchPhoneContactServlet
3.2. AddEditPhoneContactServlet
3.3. DeletePhoneContactServlet