"Javaweb" Book Management System "Summary"

Source: Internet
Author: User

Feelings

The project is so far, I have written the most code amount of projects ..... Although it is clear that there is no gold content of "Follow the video to write", but feel that they are also in progress ...

The process of writing, a lot of problems ..... A lot of servlet,jsp are dazzled by the sight ....

Now, want to put the project to a good comb points, so with this blog post ....

E-r Chart

The project involves 5 tables:user, Orders, OrderItem, category, Book

Difficulties

The most difficult part of the E-r diagram design is to do the order module there ....

Difficulty One

First, understand why the orders and OrderItem tables are designed in the order module, not a single table orders are fixed ... Of course, this can also refer to the design of the shopping cart case "cart, Cartitem"

    • Because the order module is divided into two parts, part is to display the ordinary order Information "order person, price, order time, order status"
    • In the background, we also want to display the order general information, the ability to view the details of the function "is the specific content of the order: the specific price of goods, quantity"
Difficulty Two:

Order module I was the last to start writing, the Order module and user module, library modules are connected, which is a lot more complex ....

    • One user can have multiple orders
    • One order corresponds to multiple order items
    • A book corresponds to multiple order items
Difficulty Three:
    • In a one-to-many-to-many case, we are considering the need to use a side to maintain the other side. in principle, we use more than one side to maintain a party.
    • Then why is there a time when the above sentence is not set up?? This is true: when one of our side shows up on the page, a lot of the data needs to be presented at the same time. at this point, we need to use the collection on one side to maintain the many side. For example: When we look at the order, we will definitely need to check all the order items at the same time . When you look at your shopping cart, you'll definitely need to check out your shopping items at the same time .
    • and our classification and books are not at the same time this concept . On the page, we are click Classification, only need to find out the books . Therefore, we are using many parties to maintain one side.
    • If one party is used to maintain many of the parties, then generally there is no need to use variables to maintain one side of the other in many Parties [reference to orders and order items]

Ps: If this part of the wrong place please point out, thank you!

Key points encountered in the project
  1. Creating a folder in Tomcat cannot be manager, or 403 Access denied error will occur
  2. FRAMESET tags can be nested, broken down with "cols", branch with "Rows", after the SRC specified target, after the request to jump Display page is on target specified on the page
  3. Implementing paging primarily writes code on the page class, in the DAO layer, to get the total number of records, paging data. The start and end parameters are calculated by CurrentPage and linesize.
  4. To get the paged data after categorization, we need to get the total number of records in the DAO layer, and then we can get the paging data by classification as the Where condition.
  5. We can use the FileUpload component if we have uploaded files in the submission form. Normal fields We use Beanutils's setproperty () to encapsulate the data onto the bean object, and we write the file to the specified directory on the server.
  6. On the sub-frame page, if the first page is about to display data, we can specify on the src of the frame label is Servlet,servlet and then jump back to the JSP, so that the JSP page has data!
  7. If you want div not to be all floating, we can follow a clear floating div behind. <div style="clear: both"></div>
  8. Want the button on the page to complete the corresponding function , need to use JavaScript code, through the DOM programming to get the corresponding data , use window.location.href , let it jump to the corresponding servlet to implement the function
  9. **cart and Cartiem design, the total price of Cartitem is quantity * price, cart Total Price is the sum of all cartitem price. **
  10. Cart should provide the ability to add items to the shopping cart, determine whether the item's shopping items exist , and do not exist to be created and stored inside. There is a number of shopping items +1
  11. Bussinessservice provides the purchase function, the parameters are cart and book.
  12. Users want to buy goods, determine whether the user landed, but also to determine whether the shopping cart exists " Shopping cart use session to save ", does not exist to create.
  13. You cannot name the table "order"in MySQL, so there is an error
  14. The basic information of the order can be obtained in the cart and user, and the basic information of the ordering item can be obtained in Cartitem. Therefore, in bussinessservice the cart "can be found Cartitem by cart" and the user parameter.
  15. In the DAO that generates the order, the basic information of the order, the basic information of the ordering item, is encapsulated in the database.
  16. To find the order by ID, first find out the basic information of the order . The order form and the user table are connected, you can find out the user of the order . You can find out all the order items in the order by ID . Finally, all the data found are encapsulated on the order object.
  17. To make an order that has not been shipped becomes a shipment, it is actually the status of the update order . All orders that have not been shipped and all orders that have been shipped are actually retrieved for all orders of different states .
  18. In the DAO layer, the parameters we need are often single , either specific objects or IDs ... However, in the service layer, the parameters we want are connected to the entity class .
    • Example 1: When generating an order, theDAO layer simply needs the order object parameter. In the service layer, order requires that the user, cart data be encapsulated in the order object, and these two parameters are required .
    • Example 2:cart provides the ability to add items to the shopping cart, and the parameters require only the ID of the specific item. In the service, it requires the user's shopping Cart object and the ID of the specific item.

If the article is wrong, welcome to correct, we communicate with each other. Accustomed to look at technical articles, want to get more Java resources of students, can pay attention to the public number: Java3y

"Javaweb" Book Management System "Summary"

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.