显示产品清单的问题
不要展示ProductDTO类产品 我的jsp
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>...
...<c:forEach var="ProductDTO" items="${products}" varStatus="loop"></c:forEach>
<tr>
<td><c:out value="${ProductDTO.getDescription()}"/></td>
<td><c:out value="${ProductDTO.getName() }"/></td>
</tr>...
控制器
@RequestMapping("/marketplace")
public String marketplace(Model model) {
if (!userSession.isInLoged())
return "redirect:login";
List<ProductDTO> products=productDAO.getAll();
model.addAttribute("products",products);
return "marketplace";
}
ProductDao这个
public List<ProductDTO> getAll() {
String sql = "SELECT* FROM epam_db.products";
List<ProductDTO> products = jdbcTemplate.query(sql, new ProductMapper());
if (products.isEmpty())
return null;
return products;
}
ProductDTO 包dto;
import java.sql.Date;
public class ProductDTO {
private int idProducts;
private String name;
private String description;
private Date startDate;
private int quantity;
private double price;
private int users_idusers;
// getters and setters........
}