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"
" http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd " >
<html xmlns=" http://www.w3.org/1999/xhtml "
xmlns:h=" http://xmlns.jcp.org/jsf/html "
xmlns:f=" http://xmlns.jcp.org/jsf/core "
xmlns:rt=" http://com.apress.projsf2html5/randomtext " >
<h:head>
<title>RandomText Component Demo</title>
</h:head>
<h:body>
<h1>Example page for the RandomText component</h1>
<h:form>
<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" />
</h:selectOneMenu>
Search WWH ::




Custom Search