Developing Web 2.0 applications
with JavaServerFaces
and Dreamweaver
>> Just Became Easier
Documentation
Search
  1. Introduction
  2. Getting Started
  3. Developing Web Sites
  4. Using Components
  5. Internationalization
  6. Code View Support
  7. Design View Support
  8. Keyboard Shortcuts
  9. Tag Object Toolbars
  10. JSF Server Behaviors
  11. Property Inspectors
  12. JSF Tag Reference
JSF Core Tag Library
  f:actionListener
  f:ajax
  f:attribute
  f:convertDateTime
  f:convertNumber
  f:converter
  f:event
  f:facet
  f:loadBundle
  f:metadata
  f:param
  f:phaseListener
  f:selectItem
  f:selectItems
  f:setPropertyActionListener
  f:subview
  f:validateBean
  f:validateDoubleRange
  f:validateLength
Selected f:validateLongRange
  f:validateRegex
  f:validateRequired
  f:validator
  f:valueChangeListener
  f:verbatim
  f:view
  f:viewParam
If you like this documentation, please take a look at my book:

12. JSF Core Tag Reference

Documentation > JSF > JSF Tag Reference > JSF Core Tag Library > f:validateLongRange

f:validateLongRange

The ValidateLongRange tag registers a LongRangeValidator instance on the component associated with the enclosing tag. This tag can be used to validate user input when the expected value is a long integer that is greater than or less than another value or is between two values of the same data type.

JSF Example

<!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:f="http://java.sun.com/jsf/core" 
      xmlns:h="http://java.sun.com/jsf/html">
<h:head />
<body>
<h:form>
	<h:outputLabel value="Enter an amount to withdraw: " for="withdraw" />
	<h:inputText label="Amount" id="withdraw" 
	             value="#{accountBean.withdrawAmount}">
		<f:validateLongRange minimum="20" maximum="1000" />
	</h:inputText>
	<h:commandButton value="Withdraw" actionListener="#{accountBean.withdraw}" />
	<h:message for="withdraw" errorStyle="color:red; display:block" />
</h:form>
</body>
</html>
This example was formatted by JSFToolbox for Dreamweaver.

Rendered Output

Rendered f:validateLongRange tag

When the form is submitted with the value 5 in the input field, the JSF framework will convert and validate the user input to determine if the value is between the minimum and maximum values defined by the validateLongRange tag. Since the input is not valid, the JSF framework creates a validation message that can be displayed using the h:message or h:messages tags.

Tag Attributes

binding Expression
 
The value-binding expression linking this component tag to a backing bean property.
disabled Boolean
 
The disabled attribute is a boolean flag that when set to true indicates that this component should not receive focus or be included in a form submit.
for Text
 
If present, this attribute refers to the value of one of the exposed attached objects within the composite component inside of which this tag is nested.
maximum Text
 
The maximum attribute sets the maximum value allowed for this component.
minimum Text
 
The minimum attribute sets the minimum value allowed for this component.