The template includes header and footer fragments directly, it also define a content placeholder, in the extended views the content will be inserted in the content definition.
If you are familiar with JSF before, it is easy to understand the codes.
Check out the codes and explore them yourself.
Do not forget to change the view postfix to .xhtml in the TaskController. eg. the view in allTasks method.
@GET
@View("tasks.xhtml")
public void allTasks() {
log.log(Level.INFO, "fetching all tasks");
List<Task> todotasks = taskRepository.findByStatus(Task.Status.TODO);
List<Task> doingtasks = taskRepository.findByStatus(Task.Status.DOING);
List<Task> donetasks = taskRepository.findByStatus(Task.Status.DONE);
log.log(Level.INFO, "got all tasks: todotasks@{0}, doingtasks@{1}, donetasks@{2}", new Object[]{todotasks.size(), doingtasks.size(), donetasks.size()});
models.put("todotasks", todotasks);
models.put("doingtasks", doingtasks);
models.put("donetasks", donetasks);
}
Source Codes
Clone the codes from my GitHub account.
Open the mvc-facelets project in NetBeans IDE.
Run it on Glassfish.
After it is deployed and running on Glassfish application server, navigate in browser.