HTML and CSS Reference
In-Depth Information
public Integer getMinWords() {
return minWords;
public void setMinWords(Integer minWords) {
this.minWords = minWords;
public Integer getMaxWords() {
return maxWords;
public void setMaxWords(Integer maxWords) {
this.maxWords = maxWords;
The managed bean is a plain session scoped bean with getters and setters for each of the input controls to display
to the user. The Facelets view with the input controls can be seen in Listing 6-11. The listing also shows the use of the
custom component by first declaring its use under the rt XML prefix followed by calling the component and setting
its ID. All the other attributes are copied from the backing bean. The values on the backing bean will be refreshed
through Ajax when the “Generate” button is invoked. The Ajax component tells the page to execute all the model-view
updates on the form followed by rendering the RandomText component through its client ID ( rt1 ).
Listing 6-11. Facelets View Demonstrating the RandomText Component
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
" " >
<html xmlns=" "
xmlns:h=" "
xmlns:f=" "
xmlns:rt=" http://com.apress.projsf2html5/randomtext " >
<title>RandomText Component Demo</title>
<h1>Example page for the RandomText component</h1>
<h:panelGrid columns="5">
<h:outputText value="Text Type:" />
<h:outputText value="Output Tag:" />
<h:outputText value="Count:" />
<h:outputText value="Min words:" />
<h:outputText value="Max words:" />
<h:selectOneMenu value="#{example.textType}">
<f:selectItem itemValue="gibberish" itemLabel="Gibberish" />
<f:selectItem itemValue="lorem" itemLabel="Lorem Ipsum" />
Search WWH ::

Custom Search