I have some html text. Inside it I want to print several values taken from the database. This is the html form I have created.
<form id="deal-form" th:object="${deal}" method="post"> <div class="border-t p-y-10"> <i class="fa fa-calendar" aria-hidden="true"></i> Duration<br/> Ads between <span th:value = "${hotDealDetail}" th:utext="${duration}">time</span> </div> </form> Duration value is taken from the database and included inside html text using Thymeleaf. This is the controller method.
@ModelAttribute("hotDealDetail") public String hotDealDetail( ModelMap model) { model.addAttribute("deal", new Deal()); return "hot-deal-detail"; } I see no errors. But the values taken from the database is not printed. What am I missing?
edit: deal class
@Entity @Table(name = "deal") public class Deal { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; private String name; //in seconds private double duration; @OneToMany(mappedBy = "deal") private List<DealEntry> dealEntries; @Transient private DealEntry newDealEntry; public Deal() { value = new BigDecimal(00.00); } public Long getId() { return id; } public void setId(Long id) { this.id = id; } } public double getDuration() { return duration; } public void setDuration(double duration) { this.duration = duration; }