diff --git a/src/main/java/com/dtcc/projects/productcategories/ProductCategoriesApplication.java b/src/main/java/com/dtcc/projects/productcategories/ProductCategoriesApplication.java index 26cfd41..c0b3c9b 100644 --- a/src/main/java/com/dtcc/projects/productcategories/ProductCategoriesApplication.java +++ b/src/main/java/com/dtcc/projects/productcategories/ProductCategoriesApplication.java @@ -1,13 +1,53 @@ package com.dtcc.projects.productcategories; +import com.dtcc.projects.productcategories.models.Product; +import com.dtcc.projects.productcategories.repositories.CategoryRepository; +import com.dtcc.projects.productcategories.repositories.ProductRepository; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.boot.CommandLineRunner; import org.springframework.boot.SpringApplication; +import org.springframework.boot.SpringBootConfiguration; +import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.autoconfigure.data.jpa.JpaRepositoriesAutoConfiguration; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.ComponentScan; + +import java.util.Date; +import java.util.Optional; @SpringBootApplication public class ProductCategoriesApplication { + private static final Logger log = LoggerFactory.getLogger(ProductCategoriesApplication.class); + public static void main(String[] args) { SpringApplication.run(ProductCategoriesApplication.class, args); } + /* @Bean + public CommandLineRunner demo(ProductRepository productRepository, CategoryRepository categoryRepository){ + return (args) -> { + //save few products + productRepository.save(new Product("Butter","Lite Olive Butter spread",4.99,new Date(),new Date())); + productRepository.save(new Product("Oil","Wesson brand",7.50,new Date(),new Date())); + productRepository.save(new Product("Tablet","Ipad-mini",250.99,new Date(),new Date())); + + //fetch all products. + log.info("Products found with findAll(): "); + log.info("---------------------------------"); + for(Product product : productRepository.findAll()){ + log.info(product.toString()); + } + log.info(" "); + + //fetch an individual product by ID; + Optional product=productRepository.findById(25L); + log.info("Product found with findById(25L):"); + log.info("--------------------------------"); + log.info(product.toString()); + log.info(""); + }; + }*/ } diff --git a/src/main/java/com/dtcc/projects/productcategories/controllers/AssociationController.java b/src/main/java/com/dtcc/projects/productcategories/controllers/AssociationController.java index 50fb383..c9f30c0 100644 --- a/src/main/java/com/dtcc/projects/productcategories/controllers/AssociationController.java +++ b/src/main/java/com/dtcc/projects/productcategories/controllers/AssociationController.java @@ -1,4 +1,48 @@ package com.dtcc.projects.productcategories.controllers; +import com.dtcc.projects.productcategories.models.Association; +import com.dtcc.projects.productcategories.models.Product; +import com.dtcc.projects.productcategories.services.AssociationService; +import com.dtcc.projects.productcategories.services.ProductService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.ModelAttribute; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; + +import java.util.List; + +@Controller public class AssociationController { + + @Autowired + private AssociationService associationService; + + @Autowired + private ProductService productService; + + private List productList; + @RequestMapping(value="/associations/products",method=RequestMethod.POST) + public String insertDataIntoCategoriesProducts(Model model, @ModelAttribute("association") Association associationObj){ + productList= (List) productService.showAll(); + model.addAttribute("products",productList); + + //save data into categories_products table. + associationService.save(associationObj); + return "/products/index"; + } + + @RequestMapping(value="/associations/categories",method=RequestMethod.POST) + public String insertDataFromCategoryPage(Model model, @ModelAttribute("association1") Association associationObj){ + productList= (List) productService.showAll(); + model.addAttribute("products",productList); + + //save data into categories_products table. + associationService.save(associationObj); + return "/products/index"; + } } + + diff --git a/src/main/java/com/dtcc/projects/productcategories/controllers/CategoryController.java b/src/main/java/com/dtcc/projects/productcategories/controllers/CategoryController.java new file mode 100644 index 0000000..957d9fc --- /dev/null +++ b/src/main/java/com/dtcc/projects/productcategories/controllers/CategoryController.java @@ -0,0 +1,72 @@ +package com.dtcc.projects.productcategories.controllers; + +import com.dtcc.projects.productcategories.models.Association; +import com.dtcc.projects.productcategories.models.Category; +import com.dtcc.projects.productcategories.models.Product; +import com.dtcc.projects.productcategories.services.CategoryService; +import com.dtcc.projects.productcategories.services.ProductService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.validation.BindingResult; +import org.springframework.web.bind.annotation.ModelAttribute; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; + +import javax.validation.Valid; +import java.util.Date; +import java.util.List; + +@Controller +public class CategoryController { + + @Autowired + private ProductService productService; + + @Autowired + private CategoryService categoryService; + + @RequestMapping(value="categories/{id}",method=RequestMethod.GET) + public String showById(Model model,@PathVariable Long id){ + Category category=categoryService.showById(id); + List productList= (List) productService.findByCategoriesNotContains(category); + Association associationObj=new Association(); + model.addAttribute("category",category); + model.addAttribute("association",associationObj); + model.addAttribute("notInProducts",productList); + return "categories/show"; + } + + @RequestMapping(value="/categories/category", method=RequestMethod.GET) + public String getAllCategories(Model model){ + List categories= (List) categoryService.showAll(); + model.addAttribute("categories",categories); + return "/categories/categoriesindex"; + } + @RequestMapping(value="categories/newcategory", method=RequestMethod.GET) + public String showNewCategory(Model model){ + Category category=new Category(); + model.addAttribute("newcategory",category); + return "/categories/newcategory"; + } + + @RequestMapping(value="categories/createcategory", method=RequestMethod.POST) + public String addNewCategory(@Valid @ModelAttribute("newcategory") Category category, BindingResult bindingResult){ + if (bindingResult.hasErrors()) { return "/categories/newcategory";} + else { + category.setCreatedate(new Date()); + category.setUpdatedate(new Date()); + categoryService.create(category); + return "redirect:/viewcategories"; + } + } + + @RequestMapping("/viewcategories") + public String viewCategories(Model model){ + List categoryList= (List) categoryService.showAll(); + model.addAttribute("categories",categoryList); + return "categories/categoriesindex"; + } +} + diff --git a/src/main/java/com/dtcc/projects/productcategories/controllers/ProductController.java b/src/main/java/com/dtcc/projects/productcategories/controllers/ProductController.java index 608f4e1..2fb6583 100644 --- a/src/main/java/com/dtcc/projects/productcategories/controllers/ProductController.java +++ b/src/main/java/com/dtcc/projects/productcategories/controllers/ProductController.java @@ -1,4 +1,80 @@ package com.dtcc.projects.productcategories.controllers; +import com.dtcc.projects.productcategories.models.Association; +import com.dtcc.projects.productcategories.models.Category; +import com.dtcc.projects.productcategories.models.Product; +import com.dtcc.projects.productcategories.services.CategoryService; +import com.dtcc.projects.productcategories.services.ProductService; +import org.hibernate.validator.constraints.pl.REGON; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.ui.ModelMap; +import org.springframework.validation.BindingResult; +import org.springframework.web.bind.annotation.*; + +import javax.validation.Valid; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +@Controller public class ProductController { + + @Autowired + private ProductService productService; + + @Autowired + private CategoryService categoryService; + + @RequestMapping(value="/",method=RequestMethod.GET) + public String showIndexPage(Model model){ + + List productList= (List) productService.showAll(); + model.addAttribute("products",productList); + return "products/index"; + } + + @RequestMapping(value="products/{id}",method=RequestMethod.GET) + public String showById(Model model,@PathVariable Long id){ + Product product=productService.showById(id); + System.out.println("product: "+product); + List categoryList= (List) categoryService.findByProductNotContains(product); + Association associationObject = new Association(); + model.addAttribute("product",product); + model.addAttribute("association",associationObject); + model.addAttribute("notInCategories",categoryList); + return "products/show"; + } + + @RequestMapping(value="products/newproduct", method=RequestMethod.GET) + public String showNewProduct(Model model){ + Product product=new Product(); + model.addAttribute("newproduct",product); + return "/products/newproduct"; + } + + //@ModelAttribute to read the data from the submitted form. + //to bind form data to java object. + @RequestMapping(value="products/createproduct", method=RequestMethod.POST) + public String addNewProduct(@Valid @ModelAttribute("newproduct") Product product, BindingResult bindingResult){ + + if(bindingResult.hasErrors()){return "products/newproduct";} + else { + product.setCreatedate(new Date()); + product.setUpdatedate(new Date()); + productService.create(product); + //return "redirect:/"; + return "redirect:/viewproducts"; + } + } + + @RequestMapping("/viewproducts") + public String viewProducts(Model model){ + System.out.println("in view products"); + List productList= (List) productService.showAll(); + model.addAttribute("products",productList); + return "products/index"; + } + } diff --git a/src/main/java/com/dtcc/projects/productcategories/models/Association.java b/src/main/java/com/dtcc/projects/productcategories/models/Association.java index 651200e..74b9301 100644 --- a/src/main/java/com/dtcc/projects/productcategories/models/Association.java +++ b/src/main/java/com/dtcc/projects/productcategories/models/Association.java @@ -1,4 +1,43 @@ package com.dtcc.projects.productcategories.models; +import lombok.Data; + +import javax.persistence.*; + +@Data +@Entity +@Table(name="categories_products") public class Association { + + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + private Long id; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name="products_id") + private Product product; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name="categories_id") + private Category category; + + public Association(){} + + public Association(Product product, Category category) { + this.product = product; + this.category = category; + } + + public Association(Long id, Product product, Category category) { + this.id = id; + this.product = product; + this.category = category; + } + + @Override + public String toString() { + return "Association{" + + "id=" + id + + '}'; + } } diff --git a/src/main/java/com/dtcc/projects/productcategories/models/Category.java b/src/main/java/com/dtcc/projects/productcategories/models/Category.java index 537da78..8e8e0f6 100644 --- a/src/main/java/com/dtcc/projects/productcategories/models/Category.java +++ b/src/main/java/com/dtcc/projects/productcategories/models/Category.java @@ -1,4 +1,62 @@ package com.dtcc.projects.productcategories.models; +import lombok.Data; +import lombok.ToString; + +import javax.persistence.*; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import java.util.Date; +import java.util.List; + +@Data +@Entity +@Table(name="categories") public class Category { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long id; + + @NotNull(message="is required") + @NotBlank(message="can not be empty") + private String name; + + @Column(name="created_at") + private Date createdate; + + @Column(name="updated_at") + private Date updatedate; + // @ManyToMany(targetEntity = Product.class, cascade = CascadeType.ALL) + // private List products; + @ManyToMany + @JoinTable( + name="categories_products", + joinColumns = @JoinColumn(name="categories_id"), + inverseJoinColumns = @JoinColumn(name="products_id") + ) + private List products; + + public Category(){} + + public Category(@NotNull(message = "is required") @NotBlank(message = "can not be empty") String name, Date createdate, Date updatedate) { + this.name = name; + this.createdate = createdate; + this.updatedate = updatedate; + } + + public Category(Long id, @NotNull(message = "is required") @NotBlank(message = "can not be empty") String name, Date createdate, Date updatedate) { + this.id = id; + this.name = name; + this.createdate = createdate; + this.updatedate = updatedate; + } + + @Override + public String toString() { + return "Category{" + + "id=" + id + + ", name='" + name + '\'' + + '}'; + } } diff --git a/src/main/java/com/dtcc/projects/productcategories/models/Product.java b/src/main/java/com/dtcc/projects/productcategories/models/Product.java index 731a0ae..47fede9 100644 --- a/src/main/java/com/dtcc/projects/productcategories/models/Product.java +++ b/src/main/java/com/dtcc/projects/productcategories/models/Product.java @@ -1,4 +1,64 @@ package com.dtcc.projects.productcategories.models; +import lombok.Data; +import lombok.ToString; + +import javax.persistence.*; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import java.util.Date; +import java.util.List; + +@Data +@Entity +@Table(name="products") public class Product { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long id; + + @NotNull(message="is required") + @NotBlank(message="can not be empty") + private String name; + private String description; + private double price; + + @Column(name="created_at") + private Date createdate; + + @Column(name="updated_at") + private Date updatedate; + + // @ManyToMany(targetEntity = Category.class, cascade = CascadeType.ALL) + // private List categories; + + @ManyToMany + @JoinTable( + name="categories_products", + joinColumns = @JoinColumn(name="products_id"), + inverseJoinColumns = @JoinColumn(name="categories_id") + ) + private List categories; + + public Product() {} + + + public Product(@NotNull(message = "is required") @NotBlank(message = "can not be empty") String name, String description, double price, Date createdate, Date updatedate) { + this.name = name; + this.description = description; + this.price = price; + this.createdate = createdate; + this.updatedate = updatedate; + } + + + @Override + public String toString() { + return "Product{" + + "id=" + id + + ", name='" + name + '\'' + + ", description='" + description + '\'' + + '}'; + } } diff --git a/src/main/java/com/dtcc/projects/productcategories/repositories/AssociationRepository.java b/src/main/java/com/dtcc/projects/productcategories/repositories/AssociationRepository.java index 2d1e948..d1443a2 100644 --- a/src/main/java/com/dtcc/projects/productcategories/repositories/AssociationRepository.java +++ b/src/main/java/com/dtcc/projects/productcategories/repositories/AssociationRepository.java @@ -1,4 +1,11 @@ package com.dtcc.projects.productcategories.repositories; -public interface AssociationRepository { +import com.dtcc.projects.productcategories.models.Association; +import org.springframework.data.repository.CrudRepository; +import org.springframework.stereotype.Repository; + +@Repository +public interface AssociationRepository extends CrudRepository { + + } diff --git a/src/main/java/com/dtcc/projects/productcategories/repositories/CategoryRepository.java b/src/main/java/com/dtcc/projects/productcategories/repositories/CategoryRepository.java index 18c3243..31d6513 100644 --- a/src/main/java/com/dtcc/projects/productcategories/repositories/CategoryRepository.java +++ b/src/main/java/com/dtcc/projects/productcategories/repositories/CategoryRepository.java @@ -1,8 +1,12 @@ package com.dtcc.projects.productcategories.repositories; +import com.dtcc.projects.productcategories.models.Category; +import com.dtcc.projects.productcategories.models.Product; +import org.springframework.data.repository.CrudRepository; + import java.util.List; -public interface CategoryRepository { - List findAll(); +public interface CategoryRepository extends CrudRepository { + // List findAll(); List findByProductsNotContains(Product product); } diff --git a/src/main/java/com/dtcc/projects/productcategories/repositories/ProductRepository.java b/src/main/java/com/dtcc/projects/productcategories/repositories/ProductRepository.java index 3fdd521..aa89402 100644 --- a/src/main/java/com/dtcc/projects/productcategories/repositories/ProductRepository.java +++ b/src/main/java/com/dtcc/projects/productcategories/repositories/ProductRepository.java @@ -1,8 +1,12 @@ package com.dtcc.projects.productcategories.repositories; +import com.dtcc.projects.productcategories.models.Category; +import com.dtcc.projects.productcategories.models.Product; +import org.springframework.data.repository.CrudRepository; + import java.util.List; -public interface ProductRepository { - List findAll(); +public interface ProductRepository extends CrudRepository { + //List findAll(); List findByCategoriesNotContains(Category category); } diff --git a/src/main/java/com/dtcc/projects/productcategories/services/AssociationService.java b/src/main/java/com/dtcc/projects/productcategories/services/AssociationService.java new file mode 100644 index 0000000..76b7137 --- /dev/null +++ b/src/main/java/com/dtcc/projects/productcategories/services/AssociationService.java @@ -0,0 +1,22 @@ +package com.dtcc.projects.productcategories.services; + +import com.dtcc.projects.productcategories.models.Association; +import com.dtcc.projects.productcategories.repositories.AssociationRepository; +import com.dtcc.projects.productcategories.repositories.CategoryRepository; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +@Service +public class AssociationService { + + private AssociationRepository associationRepository; + + @Autowired + public AssociationService(AssociationRepository associationRepository){ + this.associationRepository=associationRepository; + } + + public Association save(Association association){ + return (Association) associationRepository.save(association); + } +} diff --git a/src/main/java/com/dtcc/projects/productcategories/services/CategoryService.java b/src/main/java/com/dtcc/projects/productcategories/services/CategoryService.java new file mode 100644 index 0000000..ae3a1c1 --- /dev/null +++ b/src/main/java/com/dtcc/projects/productcategories/services/CategoryService.java @@ -0,0 +1,52 @@ +package com.dtcc.projects.productcategories.services; + +import com.dtcc.projects.productcategories.models.Category; +import com.dtcc.projects.productcategories.models.Product; +import com.dtcc.projects.productcategories.repositories.CategoryRepository; +import com.dtcc.projects.productcategories.repositories.ProductRepository; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +@Service +public class CategoryService { + private CategoryRepository categoryRepository; + + @Autowired + public CategoryService(CategoryRepository categoryRepository){ + this.categoryRepository=categoryRepository; + } + + public Category create(Category category){ + return categoryRepository.save(category); + } + + public Iterable createAll(Iterable category){ + return categoryRepository.saveAll(category); + } + + public Category showById(Long id){ + return categoryRepository.findById(id).get(); + } + + public Iterable showAll(){ + return categoryRepository.findAll(); + } + + public List findByProductNotContains(Product product){ + return categoryRepository.findByProductsNotContains(product); + } + public Category update(Category category){ + return categoryRepository.save(category); + } + + public Category delete(Long id){ + Category categoryToDelete=showById(id); + categoryRepository.delete(categoryToDelete); + return categoryToDelete; + } + + +} + diff --git a/src/main/java/com/dtcc/projects/productcategories/services/ProductService.java b/src/main/java/com/dtcc/projects/productcategories/services/ProductService.java new file mode 100644 index 0000000..81a21e7 --- /dev/null +++ b/src/main/java/com/dtcc/projects/productcategories/services/ProductService.java @@ -0,0 +1,73 @@ +package com.dtcc.projects.productcategories.services; + +import com.dtcc.projects.productcategories.models.Category; +import com.dtcc.projects.productcategories.models.Product; +import com.dtcc.projects.productcategories.repositories.ProductRepository; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.Date; +import java.util.List; + +@Service +public class ProductService { + + private ProductRepository productRepository; + + @Autowired + public ProductService(ProductRepository productRepository){ + this.productRepository=productRepository; + } + + public Product create(Product product){ + //System.out.println("The product id is "+product.getId()); + return productRepository.save(product); + } + + public Iterable createAll(Iterable product){ + return productRepository.saveAll(product); + } + + public Product showById(Long id){ + // return productRepository.findById(id).orElse(null); + return productRepository.findById(id).get(); + } + + public Iterable showAll(){ + return productRepository.findAll(); + } + + public List findByCategoriesNotContains(Category category){ + return productRepository.findByCategoriesNotContains(category); + } + //public Product update(Long id,String name,String description, Double price){ + public Product update(Product product){ + System.out.println("The product id in updated "+product.getId()); + /*Product product=showById(id); + if (name != null) { + product.setName(name); + } else { + product.setName(product.getName()); + } + if(description !=null){ + product.setDescription(description); + }else{ + product.setDescription(product.getDescription()); + } + if(price !=null){ + product.setPrice(price); + }else { + product.setPrice(product.getPrice()); + } + + product.setUpdatedate(new Date());*/ + return productRepository.save(product); + } + + public Product delete(Long id){ + Product productToDelete=showById(id); + productRepository.delete(productToDelete); + return productToDelete; + } +} + diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index a97c83f..54c752a 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -1,5 +1,9 @@ spring.datasource.url=jdbc:mysql://localhost:3306/products?useSSL=false&useLegacyDatetimeCode=false&serverTimezone=UTC spring.datasource.username=root -spring.datasource.password=root +spring.datasource.password=LearnHiber12@! spring.jpa.hibernate.ddl-auto=update -spring.mvc.view.prefix=/WEB-INF/ \ No newline at end of file +spring.mvc.view.prefix=/WEB-INF/ +spring.mvc.view.suffix=.jsp +#Log JPA queries +#spring.jpa.show-sql=true +logging.level.org.springframework.web=DEBUG \ No newline at end of file diff --git a/src/main/resources/data.sql b/src/main/resources/data.sql new file mode 100644 index 0000000..e69de29 diff --git a/src/main/webapp/WEB-INF/categories/categoriesindex.jsp b/src/main/webapp/WEB-INF/categories/categoriesindex.jsp index caa50ce..91bd845 100644 --- a/src/main/webapp/WEB-INF/categories/categoriesindex.jsp +++ b/src/main/webapp/WEB-INF/categories/categoriesindex.jsp @@ -14,13 +14,14 @@

Choose a Category

+
\ No newline at end of file diff --git a/src/main/webapp/WEB-INF/categories/newcategory.jsp b/src/main/webapp/WEB-INF/categories/newcategory.jsp index fe95371..0908918 100644 --- a/src/main/webapp/WEB-INF/categories/newcategory.jsp +++ b/src/main/webapp/WEB-INF/categories/newcategory.jsp @@ -7,6 +7,9 @@ + Create a Category - -
- Category Name: - - -
- - - - -
+
+

Add Category

+ +
+ Category Name: + +
+ +
+
\ No newline at end of file diff --git a/src/main/webapp/WEB-INF/categories/show.jsp b/src/main/webapp/WEB-INF/categories/show.jsp new file mode 100644 index 0000000..808e6d0 --- /dev/null +++ b/src/main/webapp/WEB-INF/categories/show.jsp @@ -0,0 +1,43 @@ +<%@ page language="java" contentType="text/html; charset=ISO-8859-1" + pageEncoding="ISO-8859-1"%> +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> +<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%> + + + + + +Products and Categories + + +
+ +

${ category.name }

+

Products:

+
    + +
  • ${ prod.name }
  • +
    +
+

Add Product ${ catgory.name }

+ + +
+ Product + + + + + + +
+ +
+
+ + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/products/index.jsp b/src/main/webapp/WEB-INF/products/index.jsp index c451a6c..ec1edad 100644 --- a/src/main/webapp/WEB-INF/products/index.jsp +++ b/src/main/webapp/WEB-INF/products/index.jsp @@ -18,8 +18,8 @@

All Products

Add Product

diff --git a/src/main/webapp/WEB-INF/products/newproduct.jsp b/src/main/webapp/WEB-INF/products/newproduct.jsp index 1d88527..c493a73 100644 --- a/src/main/webapp/WEB-INF/products/newproduct.jsp +++ b/src/main/webapp/WEB-INF/products/newproduct.jsp @@ -6,33 +6,34 @@ + Create a Product - -
- Product Name: - - -
- -
- Description: - - -
-
- Price: - - -
- - - -
+
+

Add Product

+ +
+ Product Name: + +
+
+ Description: + +
+ +
+ Price: + +
+ +
+
\ No newline at end of file diff --git a/src/main/webapp/WEB-INF/products/show.jsp b/src/main/webapp/WEB-INF/products/show.jsp index dd37ab2..89c2cc5 100644 --- a/src/main/webapp/WEB-INF/products/show.jsp +++ b/src/main/webapp/WEB-INF/products/show.jsp @@ -1,44 +1,44 @@ <%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> + pageEncoding="ISO-8859-1"%> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%> +<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%> - - -Products and Categories + + + Products and Categories -
- -

${ product.name }

-

${ product.description }

-

Category:

-
    +
    + +

    ${ product.name }

    +

    ${ product.description }

    +

    Category:

    +
      -
    • ${ cat.name }
    • +
    • ${ cat.name }
    • -
    -

    Add Category

    - - -
    - Category - - - - - - -
    - -
    -
    +
+

Add Category

+ + +
+ Category + + + + + + +
+ +
+
\ No newline at end of file