Version 5 (modified by kyli, 16 years ago) (diff) |
---|
Analysis
Overview
Book management means the ability to list, add, removes and search books by various fields.
Task requirements
- The logged in user should be able to:
- view lists of all the available books in the database.
- search the books by some criteria based on their fields(author, title, version, date uploaded...)
- add new books to the database.
- remove his/her own books.
- All of these must happen through web interface.
Task result
- pages providing book management.
Implementation idea
- Use BookService class and its methods.
- Create two jsps - to list and to add books(with form).
Related
S2S_WEB_COMMONS_R1
S2S_WEB_USER_RELATED_R0
S2S_CORE_MODEL_R0
How to demo
Show the new created pages.
Design
Create a "books.jsp" file, which lists all the persisted books on the server:
- Use the BookService class to retrieve a list with the books, and the Book class to iterate through the list, displaying each book in appropriate format. These two require importing the classes in the jsp (use <%@page import=".."%>).
- Keep in mind that the list can be very long. This means we have to display a certain number of books per page (for example 10), a link to the previous/next page. It will be best to be done using the GET method (this way copying/saving the URL will be easy).
- Access for non-logged users must be denied ( using response.sendRedirect(..); return;).
Create "search_books.jsp" file:
- Make a simple search form (like http://sophiebooks.org/s4bookstorage.html?view=search, for example), which posts the entered data to a servlet. The servlet outputs the result, using the BookService class.
- SearchServlet.java must process the GET and POST data from search_books.jsp and display the results. Since the results may be too many, 10 results must be displayed on a page, as well as links to previous/next 10 results.
Rename the uploaded_books.jsp to my_books.jsp, display there a list of the books, uploaded by the current user (using the idea of the search), and link to a new page: upload_book.jsp.
- upload_book must have a simple form for uploading a book, and s servlet processing the POST data. Again, use the BookService class. Fields in the upload form:
- Author (defaulted to the name of the user uploading the book)
- Book title (defaulted to the book filename)
- File name
- Description
- Allow cloning (defaulted to true)
- Allow commenting
- Commenters allowed to delete their own comments (defaulted to true)
- Privacy level
- Private / Public
- Password
- Group
Implementation
(Implementation results should be described and linked here (from the wiki or the repository))
Testing
Comments
(Write comments for this or later revisions here.)