Java Reference
In-Depth Information
Joe Asks. . .
What If I Want a Specific Separator in a Date Pattern?
The default behavior of the date type converter is to allow any
of
- / . ,
as separators. You can change this if you prefer to
require a specific separator in a date pattern, as in
yyyy-MM-dd
.
When
the
date
type
converter
preprocesses
the
input,
it
uses
a
regular
expression
pattern
and
replaces
all
matches
by
a
single
space.
The
default
pattern
matches
the
characters.
You
can
change
this
pattern
by
-
/
.
,
adding
a
line
in
the
file
with
the
StripesResources.properties
stripes.dateTypeConverter.preProcessPattern
key:
stripes.dateTypeConverter.preProcessPattern=\\s+
With this pattern, sequences of one or more spaces are
matched and replaced by a single space, but other charac-
ters are left intact, and you can use a specific separator in the
date pattern:
stripes.dateTypeConverter.formatStrings=yyyy-M-d
Boolean Values
Boolean properties are also supported. The type converter accepts cer-
tain values to mean
true
, and any other input produces
false
. So, this
type converter never causes a validation error—any input is accepted
and will produce either
true
or
false
.
The following values (case insensitive) are recognized as meaning
true
:
•
true
•
t
•
yes
•
y
•
on
•
1
, or any other whole number greater than zero
Anything else will be converted to
false
.
Search WWH ::
Custom Search