Hands-on to do a JSP Getting Started program (IV): Commodity entity class design (JSP)

Source: Internet
Author: User
Commodity entity class design

Examples of commodities here are books. We will build it as a JavaBean class to improve the reuse of code and the maintainability of the program. Here's a little trick to quickly add a lot of setters and getter: Right-click your class name and choose from the pop-up menu: "Source"-> "Generate getters and Setters"-> "Select All"-> " OK ".

Package entity;

Import Java.util.Date;
    public class Book {//books related attributes, which need to be set to private permissions, and the Privacy String ISBN;
    private String name;
    Private String author; Private String intro;
    Book Introduction private float Price_original;
    private float price;
    Private String Publish_comany;
    Private Date Publish_time;

Private String Img_path;
    There are all the getter and setter public String GETISBN () {return ISBN for all properties of the parameterless constructor public book () {}//;
    public void Setisbn (String ISBN) {this.isbn = ISBN;
    Public String GetName () {return name;
    public void SetName (String name) {this.name = name;
    Public String Getauthor () {return author;
    } public void Setauthor (String author) {this.author = author;
    Public String Getintro () {return intro;
    } public void Setintro (String intro) {This.intro = intro; public float getprice_original () {return price_original;
    public void setprice_original (float price_original) {this.price_original = price_original;
    public float GetPrice () {return price;
    public void Setprice (float price) {this.price = Price;
    Public String Getpublish_comany () {return publish_comany;
    } public void Setpublish_comany (String publish_comany) {this.publish_comany = Publish_comany;
    Public Date Getpublish_time () {return publish_time;
    The public void Setpublish_time (Date publish_time) {this.publish_time = Publish_time;
    Public String Getimg_path () {return img_path;
    } public void Setimg_path (String img_path) {this.img_path = Img_path; }
}

You can click here to see more about JavaBean.

Related Article

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.