Lecture 7 - Conversions and Validations Flashcards

1
Q

What happens during request values phase?

A

Submitting a form will create a request value that is stored into the components.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What happens during the Process Validation phase?

A

Conversion attempts to cast submitted value to desired local value.

Local values validated.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What types do standard converters work with?

A

primitive, enum, BigInteger/BigDecimal

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is <f:convertNumber>?</f:convertNumber>

A

converts input into a type: number, currency or percent.

Can follow a formatting pattern=””

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is <f:convertDateTime>?</f:convertDateTime>

A

converts to type: date, time, localDate, localTime…

Can follow a formatting pattern=””

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is a converter attribute?

A

An alternative to having a <f:convertNumber> tag for example in the body.</f:convertNumber>

You can add the attribute converter=”javax.faces.DateTime” for example to an input tag

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What happens during conversion errors?

A

Component declares itself invalid

JSF redisplays page with error messages using <h:message></h:message>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

How are error messages displayed?

A

Using <h:message> or <h:messages> tag</h:messages></h:message>

Note: In JSF 2.0 <h:messages></h:messages> tag is
automatically added if project stage set to
Development

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

How do you change standard conversion error messages?

A

<message-bundle>com.corejsf.messages</message-bundle>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

How is validation done?

A

Add validator component or method to a tag (custom validation).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What does immediate=”true” do in terms of validation?

A

Moves the process validations phase to occur in the apply request values phase.

Basically used to bypass validation, can be used with cancel commandButtons for example.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

How is bean validation performed?

A

Add annotations to setters/getters

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

How are custom bean validators created?

A

@Constraint (validator class)

validator class implements ConstraintValidator

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Changing bean validation default messages

A

Define ValidationMessages.properties in root package

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What interface to implement for custom converter classes?

A

implement javax.faces.convert.Converter

Annotate with @FacesConverter(“converter id”)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What interface to implement for a custom validator class?

A

javax.faces.validator.Validator

17
Q

How do we validate with bean methods?

A

Use the validator=”” attribute

18
Q
A