12. What is domain object model?
|
JSP-EL | JSF-EL |
---|---|
In JSP-EL the value expressions are delimited by ${…}. | In JSf-EL the value expressions are delimited by #{…}. |
The ${…} delimiter denotes the immediate evaluation of the expressions, at the time that the application server processes the page. | The #{…} delimiter denotes deferred evaluation. With deferred evaluation ,the application server retains the expression and evaluates it whenever a value is needed. |
More about Unified Expression Language
JSF application typically uses JSP pages to represent views. JSF provides useful special tags to enhance these views. Each tag gives rise to an associated component. JSF (Sun Implementation) provides 43 tags in two standard JSF tag libraries:
The bean instance is configured in the faces-config.xml
file:
<managed-bean> <managed-bean-name>login</managed-bean-name> <managed-bean-class>com.jtc.loginBean</managed-bean-class> <managed-bean-scope>request</managed-bean-scope> </managed-bean>
This means: Construct an object of the class com.jtc.loginBean
,
give it the name login
, and keep it alive for the duration of the request
.
We can declare the message bundle in two ways:
(Let’s assume com.jtc.messages
is the properties file)
faces-config.xml file:
<application> <resource-bundle> <base-name>com.jtc.messages</base-name> <var>message</var> </resource-bundle> </application>2. Alternatively, you can add the
f:loadBundle
element to each JSF page that needs access to the bundle:
<f:loadBundle baseName = “com.jtc.messages” var=”message”/>
Navigation rules tells JSF implementation which page to send back to the browser after a form has been submitted. We can declare the page navigation as follows:
<naviagation-rule> <from-view-id>/index.jsp</from-view-id> <navigation-case> <from-outcome>login</from-outcome> <to-view-id>/welcome.jsp</to-view-id> </navigation-case> </naviagation-rule>
This declaration states that the login
action navigates to /welcome.jsp
, if it occurred inside /index.jsp
.
If no navigation rule matches a given action, then the current page is redisplayed.