I need to populate a drop down with all the values within a list of strings.
Controller Class
@RequestMapping(value = \"/generateIds\", method = Requ
First thank to your question and answer! I've done with this solution.
My Model
@Entity
@Table(name = "test")
public class Test {
@Id
private String testCode;
private String testName;
private int price;
public Test() {}
public Test(String testCode, String testName, int price) {
this.testCode = testCode;
this.testName = testName;
this.price = price;
}
public String getTestCode() {
return testCode;
}
public String getTestName() {
return testName;
}
public int getPrice() {
return price;
}
}
My View
List test = new ArrayList<>();
model.addAttribute("test", test);
List tests = testRepository.findAll();
model.addAttribute("tests", tests);
My HTML
My Result
Image - tymeleaf dropdown from model