Book Image

Spring MVC Beginner's Guide

By : Amuthan Ganeshan
Book Image

Spring MVC Beginner's Guide

By: Amuthan Ganeshan

Overview of this book

Table of Contents (19 chapters)
Spring MVC Beginner's Guide
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Time for action – creating a domain object


So far, in your webstore, you have showed only a welcome message. It is now time for you to show your first product on the web page. Do this by creating a domain object, as follows, to represent the product information:

  1. Create a class called Product under the com.packt.webstore.domain package in the source folder src/main/java. Now, add the following code into it:

    package com.packt.webstore.domain;
    
    import java.math.BigDecimal;
    
    public class Product {
    
      private String productId;
      private String name;
      private BigDecimal unitPrice;
      private String description;
      private String manufacturer;
      private String category;
      private long unitsInStock;
      private long unitsInOrder;
      private boolean discontinued;
    private String condition;
    
      public Product() {
        super();
    }
    
      public Product(String productId, String name, BigDecimal unitPrice) {
        this.productId = productId;
        this.name = name;
        this.unitPrice = unitPrice;
      }
    
      // add setters...