The following method in my Controller is responsible for returning all values from a table in the database.
@RequestMapping("pesquisaTaxa")
public String pesquisaTaxa(@RequestParam Map<String, String> requestParams, HttpSession session, Model model) {
String sigla = requestParams.get("siglaValue");
String valorTxa = requestParams.get("valorTaxa");
this.sigla= sigla;
this.valor=valorTxa;
//List<Taxasap> listaSap = taxaDao.getAllTaxasap(); //funcionando
List<Taxasap> listaSap = (List<Taxasap>) taxaSapRepository.findAll();
if (sigla.equals("") && valorTxa.equals("")) {
for (Taxasap taxaSAP : listaSap) {
System.out.println("Sigla taxa: " + taxaSAP.getSigla() + " | Valor taxa: " + taxaSAP.getTaxa());
}
model.addAttribute("resulTaxas",listaSap);
}
return "redirect:/CadastroSAP?table";
}
The list is filled correctly with values however in the front end the values are not returned to the "list".
<div th:if="${param.table}">
<table id="data" class="table table-hover table-bordered table-responsive tableCenter">
<thead>
<tr>
<th>Sigla</th>
<th>Taxa</th>
</tr>
</thead>
<tr th:each="txa : ${resulTaxas}">
<td th:text="${txa.sigla}"></td>
<td th:text="${txa.taxa}"></td>
</tr>
</table><br/><br/>
</div><br/>