Почему данные не отправляются на следующую страницу - PullRequest
0 голосов
/ 28 апреля 2020

Данные таблицы домашней страницы не передаются для просмотра страницы продукта при нажатии, но отображается идентификатор.

Главная. jsp

 <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>

  <table class="table table-striped table-hover table-bordered">
    <thead>
        <tr>
            <th>Photo Thumb</th>
                    <th>Id</th>
                    <th>Name</th>
                    <th>Category</th>
                    <th>Description</th>
                    <th>Price</th>
                    <th>Condition</th>
                    <th>Status</th>
                    <th>Stock</th>
                    <th>Manufacturer</th>   
                    <th>View Product</th>
            </tr>
        </thead>

        <c:forEach items="${productList}" var="product">
            <tr>
                <td><img src="#" alt="image" /></td>
                <td>${product.productID}</td>   
                <td>${product.productName}</td>
                <td>${product.productCategory}</td>
                <td>${product.productDescription} USD</td>
                <td>${product.productPrice} USD</td>
                <td>${product.productCondition}</td>
                <td>${product.productStatus}</td>
                <td>${product.productUnitInStock}</td>
                <td>${product.productManufacturer}</td>  
                <td><a href="<c:url value="/view/${product.productID}"/>">Click</a></td>
            </tr>
        </c:forEach>
    </table>

Это моя домашняя страница, и данные отображаются в таблице, но не переходят на следующую страницу. ** Домашняя страница ** Home.jsp Page

ViewProduct. jsp

  <section id="product" class="page-section bg-dark text-white">
        <div class="container text-center">
        <h2 class="viewPro">View Product !</h2>
        <h3 style="color: yellow">Here is The Deatails of the Product!</h3>
       </div>

      <div class="container">
        <div class="row">
            <div class="col-md-5">
                <img src="#" alt="image" style ="width:100%; height: 350px;" />
            </div>
            <div class="col-md-5">
                <h3 style="color: white">Product Name :${product.productName}</h3>
                <h5 style="color: white">Category:${product.productCategory}</h5>
                <h5 style="color: white">condition:${product.productCondition}</h5>
                <h5 style="color: white">price : ${product.productPrice} USD</h5>
            </div>
        </div>

        </div>
    </section>

Это представление Страница продукта, и она показывает нулевое значение Просмотр страницы продукта View Product Page

Это домашняя страница контроллера, на которой я нажимаю, чтобы перейти на следующую страницу просмотра Страница продукта. homeController. java

   @Controller
    public class homeController {

    @Autowired(required=true)
    private proDaoInterface dao;

    @RequestMapping("/test")
    public String home(Model model) {
    List<ProductModel> productList = dao.getProductList();
    model.addAttribute("productList", productList);
    return "home";
 }

     @RequestMapping("/view/{productID}")
     public String viewProduct(@PathVariable String productID, Model model) 
     throws IOException {
     ProductModel product = dao.getProductByID(productID);
     model.addAttribute(product);
     return "viewProduct";

  }
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...