Java Reference
In-Depth Information
@NotNull
private String inputString;
private ToDo toDo;
private List<ToDo> toDos;
The createTask method called by the Submit button calls the createToDo method
of RequestBean :
Click here to view code image
public void createTask() {
this.toDo = request.createToDo(inputString);
}
The getToDos method, which is called by the todolist.xhtml page, calls the
getToDos method of RequestBean :
public List<ToDo> getToDos() {
return request.getToDos();
}
To force the Facelets page to recognize an empty string as a null value and return
an error, the web.xml file sets the context parameter
javax.faces.INTERPRET_EMPTY_STRING_SUBMITTED_VALUES_AS_NULL
to true :
Click here to view code image
<context-param>
<param-name>
javax.faces.INTERPRET_EMPTY_STRING_SUBMITTED_VALUES_AS_NULL
</param-name>
<param-value>true</param-value>
</context-param>
The todolist.xhtml page is a little more complicated than the index.html page.
It contains a dataTable element that displays the contents of the ToDo list. The body
of the page looks like this:
Click here to view code image
<body>
<h2>To Do List</h2>
<h:form id="showlist">
<h:dataTable var="toDo"
value="#{listBean.toDos}"
Search WWH ::




Custom Search