ArticlesTutorialsInterview Questions & AnswersCertificationsFree Books & Sample ChaptersTechnical Discussions  Your Account | Advertise with us | Feedback |
Few pages of this site are under construction and we are constantly trying to improve it. If you have any suggestions or ideas about how to improve the site, please Let us know.
JavaServer Faces Interview Questions - 2


12. What is domain object model?

Domain object model is about the business object and should belong in the business-logic tier. It contains the business data and business logic associated with the specific business object.


13. What is the difference between the domain object model and a view object?

In a simple Web application, a domain object model can be used across all tiers, however, in a more complex Web application, a separate view object model needs to be used. Domain object model is about the business object and should belong in the business-logic tier. It contains the business data and business logic associated with the specific business object. A view object contains presentation-specific data and behavior. It contains data and logic specific to the presentation tier.


14. What do you mean by Bean Scope?

Bean Scope typically holds beans and other objects that need to be available in the different components of a web application.


Don't Miss...
JSF Basic Tutorial
JSF-Spring2.0 Integration
Spring FAQs
Spring Basic Tutorial
Spring-iBatis Integration
15.  What are the different kinds of Bean Scopes in JSF?

JSF supports three Bean Scopes. viz.,
  • Request Scope: The request scope is short-lived. It starts when an HTTP request is submitted and ends when the response is sent back to the client.
  • Session Scope: The session scope persists from the time that a session is established until session termination.
  • Application Scope: The application scope persists for the entire duration of the web application. This scope is shared among all the requests and sessions.

16. What is the difference between JSP-EL and JSF-EL?

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.

     note:As of JSF 1.2 and JSP 2.1 ,the syntax of both expression languages has been unified.

More about Unified Expression Language


17. What are The main tags in JSF?

       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:

  • JSF Core Tags Library.
  • JSF Html Tags Library.

18. How do you declare the managed beans in the faces-config.xml file?

The bean instance is configured in the faces-config.xml file:


    
      <managed-bean>
    	 <managed-bean-name>login</managed-bean-name>
    	 <managed-bean-class>com.developersBookJsf.loginBean</managed-bean-class>
    	 <managed-bean-scope>request</managed-bean-scope>
      </managed-bean>
    

This means: Construct an object of the class com.developersBookJsf.loginBean, give it the name login, and keep it alive for the duration of the request.


19. How to declare the Message Bundle in JSF?

We can declare the message bundle in two ways:
(Let’s assume com.developersBookJsf.messages is the properties file)

    1.  The simplest way is to include the following elements in faces-config.xml file:
    
        <application>
    	<resource-bundle>
    	<base-name>com.developersBookJsf.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.developersBookJsf.messages” var=”message”/>
     


20. How to declare the page navigation (navigation rules) in faces-config.xml file ?

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.


21. What if no navigation rule matches a given action?  

If no navigation rule matches a given action, then the current page is redisplayed.

Test

  ALSO SEE :

About Us | Our Mission | Terms of use | Author Terms |    Search        | Contact Us | Advertise With Us | Link to Us | Sitemap
Copyright © 2016 developersBOOK.COM. All rights reserved.