1. Simple navigation
We are modifying faces-config.xml
<Navigation-Rule> -- navigation rule
<From-View-ID>/pages/index. in JSF, the view ID of JSP </from-View-ID> is calculated from the relative path of the Web application environment.
<From-View-ID> is a selective definition that specifies the conditions of the Source Page.
<Navigation-case> define various navigation conditions
<From-outcome> defines the target page to which the form results are directed when the conditions are met. The target page is defined in <to-View-ID>.
2. JSF Expression Language
JSF expression language is used together with JSF labels. It is a simple language used to access data objects.
JSF El starts with # and places the variable or formula between {}. The variable name can be the name defined in the faces-config.xml. If it is Bean, you can use '. 'operator to access its attributes, for example:
<F: View>
<H: outputtext value = "# {user. name}"> </F: View>
The variable name of El can also be the name declared during program execution, or the implicit object predefined by JSF el,
<F: View>
<H: outputtext value = "# {Param. name}"> </F: View>
<F: View>
<H: outputtext value = "# {Param. ['name']}"> </F: View>
Other variable values can be placed [].
<F: View>
<H: outputtext value = "# {somebean. somemap [user. Name]}">
</H: outputtext>
</F: View>
If the variable is a list type or array, you can specify the index in [], for example:
<H: outputtext value = "# {somebean. somelist [0]}">
</H: outputtext>
<H: outputtext value = "# {somebean. somearray [0]}">
</H: outputtext>
Specifies the literal constant. Conversion attempts are made for true, false, String, number, and JSF el.
<H: outputtext value = "# {true}">
</H: outputtext>
<H: outputtext value = "# {Hello world}">
</H: outputtext>
Iii. reserved words or Keywords of JSF
True False null Div mod and or not eq (equals) NE (no equals) lt gt le Ge instanceof
With El, you can perform some arithmetic operations, logical operations, and relational operations directly, just as in common programming languages.
Operators include +,-, ×,/or Div, and remainder % or mod.
Ternary Computation
#{(1 = 2 )? 3: 4} (expression? Result1: result2) If expression is true, result1 is displayed. If expression is false, result2is displayed.
Iv. JSF internationalization Information
The resource file name ends with. properties.
The resource file name consists of basename, language, and region, as shown in figure
Basename. Properties
Basename_en.properties
Basename_zh_cn.properties (to be continued)