Questions of Test: JSF Interview questions 2


Given property files  
in WEB-INF/classes folder, and with following definition in faces-config.xml file: 
given a jsp file: 
     <f:loadBundle basename="messages" var="msgs"/> 
    <h:form id="helloForm"> 
     Key1:<h:outputText value="#{msgs.key1}" /> 
What change will you do in 'jsp' file to load the '' file as message bundle?


Give following:
a messageBean:
public MessageBean{
  String message;
  public MessageBean(){
   message = "This is Sample Message from bean";
  public String getMessage(){ return message;}
  public void setMessage(String message){ this.message = message; }
bean definition in faces-config.xml:
and properties file in WEB-INF/classes folder with following text:
message = message from message bundle and
and a test.jsp page:
    <f:loadBundle basename="messages" var="msg"/>
      <h:outputText value="#{msg.messgae}" />
what will be the result when run test.jsf?


Given samplebean property table:
class SampleBean{
  HashMap<String,String> table;
  public HashMap<String,String> getTable() { return table;}
bean definition:
   <value>First Value</value>
   <value>Second Value</value>
which is the right way to access HashMap's data?


Given request scoped bean:
public class RequestBean {
      private String name;
      private String address;
           name = null;
           address = null;
         public String getName(){
               return name;
<%@taglib uri="" prefix="h"%>
<%@taglib uri="" prefix="f"%>
<h:outputText value="Welcome  #{}  #{requestBean.address}"></h:outputText>
Which of the following is true when we access url http://localhot/testApp/Test.faces?


About javax.faces.STATE_SAVING_METHOD Context parameter which of the following statements are true


Which of the following code are correct to access session scoped attribute cisId?


Which of the following statements displays 5 as result when run in a jsf page


Given a Java.util.List of Strings shoppingItems in a bean shoppingCart 
Which is the right way to display the List items in tabular data in JSF


<h:outputFormat value="Thanks. You have purchased {0} items. You will get discount for {1} items.">  
  <f:param value="10"/>  
What is the output of the above code?


Given personBean containing day property of type java.util.Date which is not null , given personBean configured as reques scoped  managed bean,  
what would be the result of the following when run in a jsp page 
<h:outputText value="#{}">  
<f:convertDateTime type="date" dateStyle="dd/mm/yyyy" />