Skip to content

Instantly share code, notes, and snippets.

@pmuir
Created February 20, 2012 14:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pmuir/1869566 to your computer and use it in GitHub Desktop.
Save pmuir/1869566 to your computer and use it in GitHub Desktop.
if (len <= 0) {
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage("You must enter a temperature"));
}
<div id="container">
<h:form id="convertForm">
<h:panelGrid columns="4">
<h:outputLabel for="tempFrom">Temperature:</h:outputLabel>
<h:inputText value="#{tempFrom}" id="tempFrom" />
<h:message for="tempFrom" errorClass="invalid" />
<h:commandButton id="add" value="Convert"
action="#{tempConvert.setTempFrom(tempFrom)}">
</h:commandButton>
</h:panelGrid>
</h:form>
<h:form id="response">
<h:panelGrid columns="2">
<h:outputLabel>Converts to:</h:outputLabel>
<h:outputLabel value="#{tempConvert.temperature}" />
</h:panelGrid>
</h:form>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment