I want to show all users present in a database. I want to place all users in a list and then render that list to a template.
Then I want to iterate over the list of users displaying each in a <p> tag
For u in users:
<p>u.username</p>
Endfor
I want to know how to retrieve the users from the database.
Public static Result render_f() {
List<String> users = ask in db;
return ok(template.render(users));
Is the above approach reasonable? If not can I get some pointers on where to go from here?
That’s the basic syntax, often showed in docs and samples (check ie.
computer-databasesampleapp/models/User.javaapp/controllers/Application.javatemplate.scala.html