• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

mybatis / jpetstore-6 / 2098

28 Mar 2026 11:51PM UTC coverage: 83.585% (+11.6%) from 72.006%
2098

Pull #1076

github

web-flow
Fix CDI bean-discovery-mode=none and add context.xml to prevent JSTL TLD conflict on TomEE

Agent-Logs-Url: https://github.com/mybatis/jpetstore-6/sessions/455920fa-48d7-4486-854c-27caa09007fc

Co-authored-by: hazendaz <975267+hazendaz@users.noreply.github.com>
Pull Request #1076: Fix CDI bean discovery conflict and JSTL TLD conflict on Jakarta EE full-profile containers

47 of 98 branches covered (47.96%)

108 of 196 new or added lines in 4 files covered. (55.1%)

499 of 597 relevant lines covered (83.58%)

0.84 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

56.0
/src/main/java/org/mybatis/jpetstore/web/controllers/CatalogController.java
1
/*
2
 *    Copyright 2010-2026 the original author or authors.
3
 *
4
 *    Licensed under the Apache License, Version 2.0 (the "License");
5
 *    you may not use this file except in compliance with the License.
6
 *    You may obtain a copy of the License at
7
 *
8
 *       https://www.apache.org/licenses/LICENSE-2.0
9
 *
10
 *    Unless required by applicable law or agreed to in writing, software
11
 *    distributed under the License is distributed on an "AS IS" BASIS,
12
 *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 *    See the License for the specific language governing permissions and
14
 *    limitations under the License.
15
 */
16
package org.mybatis.jpetstore.web.controllers;
17

18
import java.util.List;
19

20
import org.mybatis.jpetstore.domain.Category;
21
import org.mybatis.jpetstore.domain.Item;
22
import org.mybatis.jpetstore.domain.Product;
23
import org.mybatis.jpetstore.service.CatalogService;
24
import org.springframework.beans.factory.annotation.Autowired;
25
import org.springframework.stereotype.Controller;
26
import org.springframework.ui.Model;
27
import org.springframework.web.bind.annotation.GetMapping;
28
import org.springframework.web.bind.annotation.RequestMapping;
29
import org.springframework.web.bind.annotation.RequestParam;
30
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
31

32
@Controller
33
@RequestMapping("/catalog")
34
public class CatalogController {
1✔
35

36
  private static final String ERROR_VIEW = "common/Error";
37

38
  @Autowired
39
  private CatalogService catalogService;
40

41
  @GetMapping({ "", "/" })
42
  public String viewMain() {
43
    return "catalog/Main";
1✔
44
  }
45

46
  @GetMapping("/viewCategory")
47
  public String viewCategory(@RequestParam(value = "categoryId", required = false) String categoryId, Model model) {
48
    if (categoryId != null) {
1!
49
      List<Product> productList = catalogService.getProductListByCategory(categoryId);
1✔
50
      Category category = catalogService.getCategory(categoryId);
1✔
51
      model.addAttribute("productList", productList);
1✔
52
      model.addAttribute("category", category);
1✔
53
    }
54
    return "catalog/Category";
1✔
55
  }
56

57
  @GetMapping("/viewProduct")
58
  public String viewProduct(@RequestParam(value = "productId", required = false) String productId, Model model) {
NEW
59
    if (productId != null) {
×
NEW
60
      List<Item> itemList = catalogService.getItemListByProduct(productId);
×
NEW
61
      Product product = catalogService.getProduct(productId);
×
NEW
62
      model.addAttribute("itemList", itemList);
×
NEW
63
      model.addAttribute("product", product);
×
64
    }
NEW
65
    return "catalog/Product";
×
66
  }
67

68
  @GetMapping("/viewItem")
69
  public String viewItem(@RequestParam("itemId") String itemId, Model model) {
NEW
70
    Item item = catalogService.getItem(itemId);
×
NEW
71
    Product product = item.getProduct();
×
NEW
72
    model.addAttribute("item", item);
×
NEW
73
    model.addAttribute("product", product);
×
NEW
74
    return "catalog/Item";
×
75
  }
76

77
  @GetMapping("/searchProducts")
78
  public String searchProducts(@RequestParam(value = "keyword", required = false) String keyword, Model model,
79
      RedirectAttributes redirectAttributes) {
80
    if (keyword == null || keyword.length() < 1) {
1!
81
      model.addAttribute("message", "Please enter a keyword to search for, then press the search button.");
1✔
82
      return ERROR_VIEW;
1✔
83
    }
84
    List<Product> productList = catalogService.searchProductList(keyword.toLowerCase());
1✔
85
    model.addAttribute("productList", productList);
1✔
86
    return "catalog/SearchProducts";
1✔
87
  }
88

89
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc