Skip to main content

JAVA A to Z Interview Questions Answers3

Maven Interview Question

A list of top frequently asked maven interview questions and answers are given below.

1) What is Maven?

Maven is a project management tool. It is based on POM (Project Object Model). More details...

2) What aspects are managed by Maven?

  • Builds
  • Documentation
  • Reporing
  • SCMs
  • Releases
  • Distribution

3) What are the advantages of Maven?

  • No need to add jar file in each project
  • Creates right directory structure
  • Builds and deploys the project

4) What is the command to check the maven version?

Type the following command on console to know the maven version.
1.    mvn -version  

5) What does the build tool?

  • Generates source code (if auto-generated code is used)
  • Generates documentation from source code
  • Compiles source code
  • Packages compiled code into JAR of ZIP file
  • Installs the packaged code in local repository, server repository, or central repository

6) What is the difference between Ant and Maven?

Ant
Maven
It is a tool box.
It is a framework.
It is mainly a build tool.
It is mainly a project management tool.
There is no life cycle.
There is life cycle.
Ant doesn't have formal conventions.
Maven has a convention to place source code, compiled code etc.
Ant is procedural.
Maven is declarative.
The ant scripts are not reusable.
The maven plugins are reusable.

7) What is a MOJO?

A MOJO stands for Maven plain Old Java Object. Each MOJO is an executable goal in Maven, and a plugin is a distribution of one or more related MOJOs.

8) What is repository?

A repository is a directory or place where all the jars and pom.xml file are stored. There are 3 types of repository in Maven:
1.    Local Repository
2.    Central Repository
3.    Remote Repository

9) What is local repository?

Maven local repository is created by maven in your local system when you run any maven command. More details...

10) What is central repository?

Maven central repository is created by maven community on the web. More details...

11) What is remote repository?

Maven remote repository is located on the web by different vendors. So you need to define the dependency in pom.xml file manually. It is important because most of libraries are missing from the central repository. More details...

12) What is POM?

POM stands for Project Object Model. The pom.xml file contains information of project and project configuration. More details...

13) What are the build phases in Maven?

1.    validate
2.    compile
3.    test
4.    package
5.    integration-test
6.    verify
7.    install
8.    deploy

14) What is the command to package maven project?

1.    mvn -package  

15) What is fully qualified artifact name of maven project?

1.    <groupId>:<artifactId>:<version>  

16) What is archetype?

Archetype is the maven plugin. It creates the project structure.

JUnit Interview Question

A list of top frequently asked JUnit interview questions and answers are given below.

1) What is Testing?

Testing is the process of checking the functionality of the application whether it fulfills the requirement or not.

2) What is JUnit?

JUnit is the testing framework, it is used for unit testing of java code.
1.    JUnit = Java + Unit Testing  

3) What is unit testing?

The process of testing individual functionality (known as unit) of the application is called unit testing.

4) What is the difference between manual testing and automated testing?

Manual testing is performed by human so it is time consuming and costly. Automated testing is performed by testing tools or programs so it is fast and less costly.

5) It is necessary to write the test case for every logic?

No, we should write the test case only for those logic that can be reasonably broken.

6) What are the useful JUnit extensions?

  • JWebUnit
  • XMLUnit
  • Cactus
  • MockObject

7) What are the features of JUnit?

  • Opensource
  • Annotation support for test cases
  • Assertion support for checking the expected result
  • Test runner support to execute the test case

8) What is Unit Test Case?

A Unit Test Case is the combination of input data and expected output result. It is defined to test the functionality of an unit.

9) What is the use of @Test annotation?

The @Test annotation is used to mark the method as test method.

10) What is test suit?

The test suit allows us to group multiple test cases so that it can be run together. TestSuit is the container class under junit.framework.TestSuite package.

11) What does test runner?

The test runner is used to execute the test cases.

12) What are the important JUnit annotations?

The test runner is used to execute the test cases.
  • @Test
  • @BeforeClass
  • @Before
  • @After
  • @AfterClass

13) What does Assert class?

Assert class provides methods to test the test cases.

JSF Interview Questions

A list of top frequently asked JSF interview questions and answers are given below.

1) What is JSF (JavaServer Faces)?

It is a server side component based user interface framework. It is used to develop web applications. It provides a well-defined programming model and consists of rich API and tag libraries. The latest version JSF 2 uses Facelets as its default templating system.
For more information: Click here

2) What are the benifits of JSF (JavaServer Faces)?

It provides clean and clear separation between behavior and presentation of web application. You can write business logic and user interface separately.
For more information: Click here

3) What are the features of JSF (JavaServer Faces)?

Latest version of JSF 2.2 provides the following features.
  • Component Based Framework
  • Implements Facelets Technology
  • Integration with Expression Language
  • Support HTML5
  • Ease and Rapid web Development.
  • Support Internationalization
  • Bean Annotations
For more information: Click here

4) What is lifecyle of JSF (JavaServer Faces)?

JavaServer Faces application framework manages lifecycle phases automatically for simple applications and also allows you to manage that manually. The lifecycle of a JavaServer Faces application begins when the client makes an HTTP request for a page and ends when the server responds with the page.
For more information: Click here

5) How does execution phase work in JSF (JavaServer Faces) lifecyle?

In execute phase, when first request is made, application view is built or restored. For other subsequent requests other actions are performed like request parameter values are applied, conversions and validations are performed for component values, managed beans are updated with component values and application logic is invoked.
For more information: Click here

6) How does render phase work in JSF (JavaServer Faces) lifecyle?

In this phase, the requested view is rendered as a response to the client browser. View rendering is a process in which output is generated as HTML or XHTML. So, user can see it at the browser.
For more information: Click here

7) What is managed bean in JSF (JavaServer Faces)?

It is a pure Java class which contains set of properties and set of getter, setter methods.
Following are the common functions that managed bean methods perform:
  • Validating a component's data
  • Handling an event fired by a component
  • Performing processing to determine the next page to which the application must navigate
For more information: Click here

8) How to configure managed bean in XML file?

In thiscase, we configure bean-name, bean-class and bean-scope in XML file. So, it can be accessible in the project. This is an older approach to configure bean into xml file.
For more information: Click here

9) What are the available scopes for managed bean?

You can use following scopes for a bean class:
  • Application (@ApplicationScoped): Application scope persists across all users? interactions with a web application.
  • Session (@SessionScoped): Session scope persists across multiple HTTP requests in a web application.
  • View (@ViewScoped): View scope persists during a user?s interaction with a single page (view) of a web application.
For more information: Click here

10) What is eager managed bean?

Managed bean is lazy by default. It means, bean is instantiated only when a request is made from the application.
You can force a bean to be instantiated and placed in the application scope as soon as the application is started.
For more information: Click here

11) What are User Interface Components in JSF (JavaServer Faces)?

JavaServer Faces HTML tag library represents HTML form components and other basic HTML elements, which are used to display or accept data from the user. A JSF form send this data to the server after submitting the form.
For more information: Click here

12) What is h:inpuText tag in JSF (JavaServer Faces)?

The JSF <h: inputText> tag is used to render an input field on the web page.
It is used within a <h: form> tag to declare input field that allows user to input data.
For more information: Click here

13) What is h:outputText tag in JSF (JavaServer Faces)?

The JSF <h:outputText> is used to render a plain text. If the "styleClass", "style", "dir" or "lang" attributes are present, render a "span" element. If the "styleClass" attribute is present, render its value as the value of the "class" attribute.
For more information: Click here

14) What is h:form tag in JSF (JavaServer Faces)?

The <h:form> tag represents an input form. It includes child components that can contain data which is either presented to the user or submitted with the form. It can also include HTML markup to lay out the components on the page.
For more information: Click here

15) What is h:commandButton tag in JSF (JavaServer Faces)?

The <h:commandButton>tag creates a submit button and used to submit a application form.
For more information: Click here

16) What is h:inputTextarea tag in JSF (JavaServer Faces)?

The <h:inputTextarea>tag renders an HTML "textarea" element. It allows a user to enter multiline string.
For more information: Click here

17) What is h:commandLink tag in JSF (JavaServer Faces)?

JSF renders it as an HTML "a" anchor element that acts like a form submit button when clicked. So, you can create anchor tag by using this tag. An h:commandLink tag must include a nested h:outputText tag, which represents the text that the user clicks to generate the event. It's also required to be placed inside a <h:form> tag.
For more information: Click here

18) What is h:inputSecret tag in JSF (JavaServer Faces)?

It is a standard password field which accepts one line of text with no spaces and displays it as a set of asterisks as it is entered. In other words, we say, it is used to create a HTML password field which allows a user to input a string without the actual string appearing in the field.
For more information: Click here

19) What is h:inputHidden tag in JSF (JavaServer Faces)?

It renders an HTML "input" element of type hidden. It does not appear in web page, so you can pass hidden information while submitting form.
For more information: Click here

20) What is h:inputFile tag in JSF (JavaServer Faces)?

JSF renders it as an HTML element of type file. It is used to get file as input. In HTML form, it allows a user to upload a file.
For more information: Click here

21) What is h:graphicImage tag in JSF (JavaServer Faces)?

JSF renders an HTML element "img" tag. This tag is used to render an image on the web page.
For more information: Click here

22) What is h:message tag in JSF (JavaServer Faces)?

It is used to display a single message for a particular component. You can display your custom message by passing id of that component into the for attribute.
For more information: Click here

23) What is h:messages tag in JSF (JavaServer Faces)?

It is used to displays all messages that were stored in the faces context during the course of the JSF life cycle.
For more information: Click here

24) What is h:dataTable tag in JSF (JavaServer Faces)?

It is used to create a data table. A table that can be updated dynamically.
For more information: Click here

25) What are available validation tags in JSF (JavaServer Faces)?

JavaServer Faces technology provides a set of standard classes and associated tags that you can use to validate elements data. A table which contains the validation tags is given.
For more information: Click here

26) What is f:validateBean tag in JSF (JavaServer Faces)?

It is used to register a bean validator to the component. For validating bean model, you must set the context parameter in the web deployment descriptor file web.xml.
For more information: Click here

27) What is f:validateDoubleRange tag in JSF (JavaServer Faces)?

It is used to check that the value of a input field is within a certain range or not. The value must be a float or double type.
For more information: Click here

28) What is f:validateLength tag in JSF (JavaServer Faces) ?

It is used to check whether the length of a component's value is within a certain range or not. The value must be a java.lang.String.
For more information: Click here

29) What is f:validateLongRange tag in JSF (JavaServer Faces)?

It is used to check whether the local value of a component is within a certain range or not. The value must be any numeric type or String that can be converted to a long.
For more information: Click here

30) What is f:validateRegex tag in JSF (JavaServer Faces)?

It is used to check whether the local value of a component is a match against a regular expression from the java.util.regex package or not.
For more information: Click here

31) What is f:validateRequired tag in JSF (JavaServer Faces)?

It is used to ensure that the local value is not empty on an EditableValueHolder component.
For more information: Click here

32) How to validate managed bean in JSF (JavaServer Faces)?

JSF provides validation constraints for bean model in the form of annotations. You can place that annotations on a field, method, or class of a JavaBeans component, such as a managed bean.
For more information: Click here

33) What are standard converters in JSF (JavaServer Faces)?

The JavaServer Faces provides a set of Converters. You can use that to convert component data. The purpose of conversion is to take the String-based data from the Servlet API and convert it to strongly typed Java objects.
For more information: Click here

34) What is f:converter tag in JSF (JavaServer Faces)?

It is a core converter tag. It is used to add an arbitrary converter to the parent component.
For more information: Click here

35) What is f:convertDateTime tag in JSF (JavaServer Faces)?

It is used to convert user input into specified date. You can convert a component's data to a java.util.Date by nesting the convertDateTime tag inside the component tag. The convertDateTime tag has several attributes that allow you to specify the format and type of the data.
For more information: Click here

36) What is f:convertNumber tag in JSF (JavaServer Faces)?

It is used to convert component (user input) data into a Java Number type. You can convert a component's data to a java.lang.Number by nesting the convertNumber tag inside the component tag. The convertNumber tag has several attributes that allow you to specify the format and type of the data.
For more information: Click here

37) How to refer bean method in JSF (JavaServer Faces)?

We refer a managed bean method that performs navigation processing for the component and returns a logical outcome String.
For more information: Click here

38) What is Facelets?

It is a light weight page declaration language which is used to build JavaServer Faces views using HTML style.
For more information: Click here

39) What are advantages of Facelets?

1) It supports code reusabilty through templating and composite components.
2) It provides functional extensibility of components and other server-side objects through customization
For more information: Click here

40) What is lifecyle of Facelets application in JSF (JavaServer Faces)?

The JavaServer Faces specification defines the lifecycle of a JavaServer Faces application. The following steps describe that process to a Facelets-based application.
1) Lifecycle starts when a client makes a new request for a web page which is created using Facelets. JSF creates a new component tree or javax.faces.component.UIViewRoot and placed into the FacesContex.
For more information: Click here

41) How to create a Fecelet view?

Facelets views are XHTML pages. You can create a web page or view, by adding components to the page, wire the components to backing bean values and properties, and register converters, validators, or listeners on the components.
For more information: Click here

42) How to map Faces Servlet instance in JSF (JavaServer Faces) application?

Configure of a JavaServer Faces application is done by mapping the Faces Servlet in the web deployment descriptor file a web.xml.
For more information: Click here

43) What are Facelets Templates?

It is a tool which provides the facility to implement the user interface. Templating is a useful Facelets feature that allows you to create a page that will act as the base for the other pages in an application. By using templates, you can reuse code and avoid recreating similarly pages again and again.
For more information: Click here

44) How to create Facelets Templates?

Templating is a useful Facelets feature that allows you to create a page that will act as the base for the other pages in an application.
For more information: Click here

45) What are Facelets Composite Components?

JSF provides the concept of composite components with Facelets. Composite component is a special type of template that acts as a component in your application.
For more information: Click here

46) What are web resources in JSF (JavaServer Faces)?

JSF web resources are the resources which are required for proper rendering in the web application. It includes images, script files, and any user-created component libraries.
For more information: Click here

47) How to access CSS (Cascading Style Sheets) File in JSF (JavaServer Faces) application?

The <h:outputStylesheet> tag is used to access CSS (Cascading Style Sheets) resource in the web application. You must create a subdirectory inside the resources folder.
For more information: Click here

48) How to access JS (JavaScript) File in JSF (JavaServer Faces) application?

The <h:outputScript> tag is used to access JavaScript file in the web application. You must create a subdirectory inside the resources folder.
For more information: Click here

49) How to relocate web resources in JSF (JavaServer Faces) application?

JSF provides a facility to place your resources at any section of your web page and render it to another section. . You can relocate your resource by specifying target attribute.
For more information: Click here

50) How to create JDBC (Java Database Connectivity) connection in JSF (JavaServer Faces) application?

You can integrate JSF application to the jdbc. JDBC allows you to store data into the database table.
For more information: Click here 

PrimeFaces Interview Questions


1) What is PrimeFaces?

It is an UI (User Interface) library for JSF (JavaServer Faces) based applications. It is designed and developed by PrimeTek. It is Cross-platform, open source and written in Java programing language.
For more information Click here.

2) What are the features of PrimeFaces?

PrimeFaces is full of features, some are listed below.
  • Rich UI Components
  • Ajax Support
  • Push Support
  • Dialog Suppport
For more information Click here.

3) How to configure PrimeFaces in JSF application?

To configure primefaces in our JSF application, we need to download only one JAR file primefaces-{version}.jar. We can manually download it from the official site of primfaces.
For more information Click here.

4) PrimeFaces Ajax support.

Primefaces provides built-in Ajax support. It provides various attributes like update, event, listener etc. Here, we are creating an example that explains ajax attributes.
For more information Click here.

5) How to implement PrimeFaces autoComplete component in JSF (JavaServer Faces)?

It is an input component that provides live suggestions while an input is being typed.
Suggestions are loaded by calling a server side completeMethod that takes a single string parameter.
For more information Click here.

6) How to implement PrimeFaces inputTextArea component in JSF (JavaServer Faces)?

PrimeFaces provides <p:inputTextarea> component to create a text area in JSF application. It is an extension of standard inputTextarea. It includes various features like: autoComplete, autoResize etc.
For more information Click here.

7) How to implement PrimeFaces selectBooleanButton component in JSF (JavaServer Faces)?

The <p:selectBooleanButton> is used to create BooleanButton in JSF application. We can use it to get boolean input from the user. It provides a toggle button to interact with user.
For more information Click here.

8) How to implement PrimeFaces selectBooleanCheckbox component in JSF (JavaServer Faces)?

PrimeFaces provides <p:selectBooleanCheckbox> component to create boolean checkbox. It is used to get a boolean value from the user. It is an extended version of the standard checkbox with theme integration.
For more information Click here.

9) How to implement PrimeFaces calendar component in JSF (JavaServer Faces)?

It is an input component which is used to select date. The <p:calendar> component is used to create a calendar in JSF application. It includes various features like: display modes, paging, localization, ajax selection etc.
For more information Click here.

10) How to implement PrimeFaces selectCheckboxMenu component in JSF (JavaServer Faces)?

It is used to choose multiple items displayed in an overlay. We can create it by using <p:selectCheckboxMenu> component. It displays options in an overlay. It provides attribute that are tabled below.
For more information Click here.

11) How to implement PrimeFaces editor component in JSF (JavaServer Faces)?

PrimeFaces provides <p:editor> component which is used to create an editor in JSF application. We can use this editor to get user input in large amount. This editor provides editing and formating tools that we can use to format our input.
For more information Click here.

12) How to implement PrimeFaces inputText component in JSF (JavaServer Faces)?

It is an extension to the standard inputText with skinning capabilities. We can create it by using the <p:inputText> component. It is used to get user input in JSF application.
For more information Click here.

13) How to implement PrimeFaces inputMask component in JSF (JavaServer Faces)?

It is a special type of input box which forces user to enter formatted input. We can create it by using <p:inputMask> component. It takes input in a certain pattern. It is useful when we want formated user input.
For more information Click here.

14) How to implement PrimeFaces selectOneListbox component in JSF (JavaServer Faces)?

It is an extended version of the standard selectOneListbox component. It is used to select one value from the list. PrimeFaces provides <p:selectOneListbox> component to create listbox. It is useful when we want to get user choice from the multiple options.
For more information Click here.

15) How to implement PrimeFaces selectManyButton component in JSF (JavaServer Faces)?

It is a multi select component using button user interface. The <p:selectManyButton> component is used to create multiple buttons. It is used to get user input by using buttons.
For more information Click here.

16) How to implement PrimeFaces selectManyCheckbox component in JSF (JavaServer Faces)?

It is used to select multiple values from given options. It is useful when we want to take multiple user inputs from a collection. We can use <p:selectManyCheckbox> component to create SelectManyCheckbox in JSF application.
For more information Click here.

17) How to implement PrimeFaces selectOneButton component in JSF (JavaServer Faces)?

It is used to select a single item from a list using buttons. It creates items list as a list of buttons. So, we can select item by clicking on the button. The <p:selectOneButton> component is used to create list of buttons in the JSF application.
For more information Click here.

18) How to implement PrimeFaces selectOneRadio component in JSF (JavaServer Faces)?

It is used to choose a single item from a list of options. It is an extended version with theme integration. The <p:selectOneRadio> component is used to create list of radio buttons. It is useful when we want a single input from the user.
For more information Click here.

19) How to implement PrimeFaces signature component in JSF (JavaServer Faces)?

It is used to draw a signature as an input. It provides a canvas where we can draw signature. It provides various options such as background color, foreground color, thickness for customization. It can be used in touch enabled devices. In JSF application, we can create it by using the <p:signature> component.
For more information Click here.

20) How to implement PrimeFaces spinner component in JSF (JavaServer Faces)?

It is an input text which provides increment and decrement buttons. It is used to get user input in a input text. We can create it by using <p:spinner> component in our JSF application.
For more information Click here.

21) How to implement PrimeFaces slider component in JSF (JavaServer Faces)?

It is a text input with slider. It is used to get user input with the help of slider. It allows us to increment and decrement input by using slider. The <p:slider> component is used to create slider input text.
For more information Click here.

22) How to implement PrimeFaces inputSwitch component in JSF (JavaServer Faces)?

It is used to take a boolean value as input from the user. It is a button which toggles ON or OFF. We can create it by using <p:inputSwitch> component.
For more information Click here.

23) How to implement PrimeFaces password component in JSF (JavaServer Faces)?

It is an input field which takes hidden value from the user. The <p:password> component is used to create a password field in JSF application. It also provides feedback while entering the password.
For more information Click here.

24) How to implement PrimeFaces keyboard component in JSF (JavaServer Faces)?

It is a input text box which displays virtual keyboard to enter data. It used to get user input by using pointer device. So, a user can enter input without having keyboard. The <p:keyboard> component is used to create virtual keyboard.
For more information Click here.

25) How to implement PrimeFaces rating component in JSF (JavaServer Faces)?

It is a star based rating system. It is used to take user input as a rating. It is useful when we want to get user feedback. It is mostly used to get product rating.
For more information Click here.

26) How to implement PrimeFaces colorPicker component in JSF (JavaServer Faces)?

It is an input component with a color palette. It allows us to select and reselect color in web application. We can use it in our JSF application to get color as user input.
For more information Click here.

27) How to implement PrimeFaces inplace component in JSF (JavaServer Faces)?

It is an input text box which provides easy editing of value at browser. It consists of two members, display element is the initial clickable label and inline element is the hidden content that is displayed when display element is toggled.
For more information Click here.

28) How to implement PrimeFaces knob component in JSF (JavaServer Faces)?

It is an input component which is used to get numeric value. It is used to get user input in a specified range. PrimeFaces provides <p:knob> component which is used to create a graphical circle.
For more information Click here.

29) How to implement PrimeFaces chips component in JSF (JavaServer Faces)?

It is an input text box which is used to enter multiple values. The <p:chips> component is used to create input text in the JSF application. It is useful when we want to take multiple values from the user by using single component.
For more information Click here.

30) How to implement PrimeFaces button component in JSF (JavaServer Faces)?

It is an extension to the standard h:button JSF component with advanced skinning features. It is used to send GET request on the web. The <p:button> component is used to create button in JSF application.
For more information Click here.

31) How to implement PrimeFaces commandButton component in JSF (JavaServer Faces)?

It is an extended version of standard h:commandButton of JSF. It includes ajax, partial processing and skinning features.
The <p:commandButton> component is used to create button in JSF application.
For more information Click here.

32) How to implement PrimeFaces commandLink component in JSF (JavaServer Faces)?

It is an extended version of JSF h:commandLink with Ajax, partial processing and confirmation feature. It is used to create a link which redirects control to specified target.
The <p:commandLink> component is used to create a link in JSF application.
For more information Click here.

33) How to implement PrimeFaces splitButton component in JSF (JavaServer Faces)?

It is a button which displays a default command and additional ones in an overlay. It is used to provide multiple commands. The <p:splitButton> component is used to create splitButton in JSF application.
For more information Click here.

34) How to implement PrimeFaces accordionPanel component in JSF (JavaServer Faces)?

It is a container component which displays vertically stacked panels. It is used to display data in accordion format. We can switch anytime from one item to another just by clicking on that item. It is useful when user want to see single item at a time from the collection.
For more information Click here.

35) How to implement PrimeFaces fieldset component in JSF (JavaServer Faces)?

It is a grouping component and an extension of html fieldset. It is a kind of container that has a legend and content. It is used to display categorized data.
PrimeFaces provides <p:fieldset> component which is used to create fieldset in JSF application.
For more information Click here.

36) How to implement PrimeFaces layout component in JSF (JavaServer Faces)?

It is a highly customizable borderLayout model. It is easy to create complex layouts even if we are not familiar with web design. It consists of 5 different layout units which are top, left, center, right and bottom. We can refer that as east, west, north, south and center.
For more information Click here.

37) How to implement PrimeFaces notificationBar component in JSF (JavaServer Faces)?

It is a multipurpose fixed positioned panel. It is used to display notification bar. By default, it displays at the top. We can set it's position by specifying position attribute. We can also set the effect of notification bar like: fade or slide.
For more information Click here.

38) How to implement PrimeFaces toolbar component in JSF (JavaServer Faces)?

It is a horizontal grouping component which is used to form a toolbar with commands and other content. PrimeFaces provides <p:toolbar> component to create toolbar in JSF application. It is useful to create tool based web application.
For more information Click here.

39) How to implement PrimeFaces confirm component in JSF (JavaServer Faces)?

It is an advanced version of JavaScript confirmation box. It includes various features like: skinning, customization and avoiding pop up blockers. It is used to create a confirmation dialog box to get user response.
For more information Click here.

40) How to implement PrimeFaces dialog component in JSF (JavaServer Faces)?

It is a panel component which can overlay other elements on page. It is used to create a pop-up that can be used to display other elements too. It provides two methods show() and hide() to manage visibility of the component.
For more information Click here.

41) How to implement PrimeFaces tooltip component in JSF (JavaServer Faces)?

It is a small pop-up box that displays information on the event. It is used to display message to the user when the user interact with the component. It includes various features like cutom effects, events and theme support.
For more information Click here.

42) How to implement PrimeFaces breadCrumb component in JSF (JavaServer Faces)?

It is a navigation component which is used to provide contextual information about page hierarchy. It show navigation information and allows to redirect to any page by clicking on the navigation link. The <p:breadCrumb> component is used to create navigation in JSF application.
For more information Click here.

43) How to implement PrimeFaces menubar component in JSF (JavaServer Faces)?

It is a horizontal navigation component which provides menus options. It is used to collect menus and display that in an organize row.
We can create menubar by using <p:menubar> component in JSF application.
For more information Click here.

44) How to implement PrimeFaces stack component in JSF (JavaServer Faces)?

This components is an indicator for the steps in a workflow. It indicates that at what step we are right now. It is used to show current step in multi-steps application.
The <p:steps> component is used to create steps indicator in the JSF application.
For more information Click here.

45) How to implement PrimeFaces steps component in JSF (JavaServer Faces)?

This components is an indicator for the steps in a workflow. It indicates that at what step we are right now. It is used to show current step in multi-steps application.
The <p:steps> component is used to create steps indicator in the JSF application.
For more information Click here.

46) How to implement PrimeFaces Areachart component in JSF (JavaServer Faces)?

It is a customized and advanced version of a LineChart where series are filled. It is used to represent statistical data graphically. The <p:chart> is a generic component to create chart in JSF application. We can set type of chart to specify the type of chart.
For more information Click here.

47) How to implement PrimeFaces piechart component in JSF (JavaServer Faces)?

It is a type of graph in which a circle is divided into sectors and each sector represent some statistic. It is a way to represent statistical data graphically. The <p:chart> component is used to create chart.
For more information Click here.

48) How to implement PrimeFaces growl component in JSF (JavaServer Faces)?

It is a notification widget which is used to display FacesMessages. It is similar to standard h:messages component of JSF. We can place growl to anywhere in our application's web page. The location of growl in JSF application does not matter.
For more information Click here.

49) How to implement PrimeFaces fileUpload component in JSF (JavaServer Faces)?

It is an input component which is used to upload file to the server. It allows us to upload file from the browser to the server. It includes HTML5 features and has nice user interface with progress bar and other useful butttons.
For more information Click here.

50) How to implement PrimeFaces fileUpload component in JSF (JavaServer Faces)?

It is a process status indicator that can either work purely on client side or interact with server side using Ajax. It is used to show the status and progress of executing process.
For more information Click here.

RichFaces Interview Questions


1) What is RichFaces?

RichFaces is an open source, advanced user interface component framework which is used to easily integrate Ajax capabilities into JavaServer application.
For more information Click here,

2) What are the advantages of RichFaces?

RichFaces provides numerous advantages like:
  • Provides rich user interface components library.
  • Allows to create custom components with built in ajax support.
For more information Click here,

3) How to configure RichFaces in JSF?

To configure RichFaces, we need to download JARs provided by Jboss. After downloading, we can add that in our project.
For more information Click here.

4) What is the architecture of RichFaces?

Architecture of RichFaces consist of the following components.
  • Ajax Action Components.
  • Ajax Containers
For more information Click here.

5) How to send Ajax request in RichFaces ?

RichFaces provides tag libraries which are capable to send Ajax request from JavaServer Faces pages.
  • The <a4j:commandButton> and <a4j:commandLink> tags are used to send an Ajax request on the click JavaScript event.
For more information Click here.

6) Why do we use RichFaces <a4j:log> component?

The <a4j:log> component generates JavaScript that opens a debug window, logging application information such as requests, responses, and DOM changes.
For more information Click here.

7) Why do we use RichFaces outputPanel?

This component is used to group components together to update that as a whole rather than specify the components individually.
For more information Click here.

8) How to implement RichFaces calendar in JSF?

RichFaces provides calendar component that we can implement in the JSF file.
For more information Click here.

9) How to implement RichFaces editor in JSF?

RichFaces provides the <rich:editor> component which is used to create a WYSIWYG editor in the HTML page.
The <rich:editor> component is based on the CKEditor implementation.
For more information Click here.

10) How to upload file using RichFaces?

RichFaces provides the <rich:fileUpload> component which is used to upload files to the server. It provides lots of attributes that we can use in our application.
For more information Click here.

11) What is RichFaces inplaceInput?

RichFaces provides <rich:inplaceInput> component which is used to create a editable text box. It allows text to be entered in-line in blocks of text.
For more information Click here.

12) What is difference between inplaceInput and inplaceSelect?

InplaceSelect component is similar to the <rich:inplaceInput> component, except that it uses a drop-down selection box to enter text instead of a text field.
For more information Click here.

13) What is RichFaces inputNumberSlider?

It provides a slider for changing numerical values. It is used to select numerical value by selecting from the slider's range.
For more information Click here.

14) What is RichFaces inputNumberSpinner?

This component is a single-line input field with buttons to increase and decrease a numerical value. It is used to input values by using provided spinner.
For more information Click here.

15) How to use RichFace select in JSF?

We can use it in an auto-completing mode, where the values in the drop-down list are provided dynamically using either the autocompleteMethod or autocompleteList attributes.
For more information Click here.

16) What is the RichFaces orderingList?

RichFaces provides <rich:orderingList> component for ordering items in a list at client-side. We need to use the value attribute to the list to be ordered.
For more information Click here.

17) What is the RichFaces pickList?

It is used to select items from a list. It allows us to change order of selected items at client-side. We can add, remove items from the source list to the target list and vice-versa.
For more information Click here.

18) What is the RichFaces panel?

It is a bordered panel with an optional header. For basic usage, it does not require any attribute. A <rich:panel> without any attributes defined renders a bordered region with no header.
We should use header attribute to specify the text to appear in the header.
For more information Click here.

19) How to implement RichFaces dataTable in JSF?

It is used to render a table which displays data in tabular form. It works with the <rich:column> and <rich:columnGroup> components to list the contents of a data model.
For more information Click here.

20) What is difference between RichFaces dataTable and collapsibleSubTable?

This component acts as a child element to the <rich:dataTable>. It iterates through the child collections in the currently iterated object to create detailed tables.
For more information Click here.

21) What is RichFaces list?

RichFaces provides <rich:list> to render a list of items. We can create numerically ordered list, an un-ordered, bullet-point list etc. It uses a data model for managing the list items which can be updated dynamically.
For more information Click here.

22) How to make table scrollable using RichFaces?

The<rich:dataScroller> is used for navigate through multiple pages of tables. It must be places in a facet of the table. We can also use the for attribute to bind parent tables to the scroller.
For more information Click here.

23) How to implement RichFaces tree in JSF?

The <rich:tree> component is used to create a hierarchical tree. It uses <rich:treeNode> as a child component.
We can create customize tree according to our requirement.
For more information Click here.

24) How to create RichFaces drop-dow menu in JSF?

The <rich:dropDownMenu> component is used to create a drop-down or a hierarchical menu. We can use it with the <rich:toolbar> component to create menus in an application?s toolbar.
For more information Click here.

25) How to create RichFaces toolbar in JSF?

The <rich:toolbar> component is used to create a horizontal toolbar. Any JavaServer Faces ( JSF) component can be added to the toolbar.
The <rich:toolbar> component does not require any attributes to be defined for basic usage.
For more information Click here.

26) What is difference between RichFaces message and messages?

The <rich:messages> component works similar to the <rich:message> component and automatically rendered after an Ajax request. It is used to display all the validation messages of the current web page collectively.
For more information Click here.

27) What is RichFaces notifyStack?

It is used to define the position of messages at the web page. Messages displayed by <rich:notify> or <rich:notifyMessage> are displayed in top-right corner of the web page by default.
For more information Click here.

28) How to implement RichFaces progress bar in JSF?

Progress Bar is used to display the status of a process. It can update either through Ajax or on the client side, and the look and feel can be fully customized.
For more information Click here.

29) What is RichFaces tool-tip?

It is used to provide an informational tool-tip. We can attach tool-tip to any control and is displayed when hovering the mouse cursor over the control.
For more information Click here.

30) What are the features of RichFaces?

RichFaces has following features:
  • JSF Integration
  • Error handling
For more information Click here.

Web Services Interview Questions

There is given frequently asked Web Services interview questions and answers that has been asked in many companies. Let's see the list of top Web Services interview questions.

1) What is Web Service?

Web Service is a software system for communicating two devices over the network. More details...

2) How does a web service work?

A web service is used to communicate among various applications by using open standards such as HTML, XML, WSDL, and SOAP. You can build a Java-based web service on Solaris that is accessible from your Visual Basic program that runs on Windows. You can also use C# to build new web services on Windows that can be invoked from your web application that is based on JavaServer Pages (JSP) and runs on Linux.

3) What are the advantages of web services?

  • Interoperability: By the help of web services, an application can communicate with other application developed in any language.
  • Reusability: We can expose the web service so that other applications can use it.
  • Modularity: By the help of web service, we can create a service for a specific task such as tax calculation etc.

4) What are the different types of web services?

There are two types of web services:
  • SOAP
  • RESTful

5) What are the main features of web services?

Following is a list of main features of web services:
  • It is available over the Internet or private (intranet) networks.
  • It uses a standardized XML messaging system.
  • It is not tied to any one operating system or programming language.
  • It is self-describing via a common XML grammar.
  • It is discoverable via a simple find mechanism.

6) What is SOAP?

SOAP stands for Simple Object Access Protocol. It is a XML-based protocol for accessing web services. More details...

7) What are the advantages of SOAP web services?

  • WS Security
  • Language Independent
  • Platform Independent

8) What are the disadvantages of SOAP web services?

  • Slow
  • WSDL Dependent

9) What are the main features of SOAP?

The following list specifies the features of SOAP:
  • SOAP is a communication protocol.
  • SOAP is used for communication between applications.
  • SOAP is a format for sending messages.
  • SOAP is designed to communicate via Internet.
  • SOAP is platform independent.
  • SOAP is language independent.
  • SOAP is simple and extensible.
  • SOAP allows you to get around firewalls.
  • SOAP will be developed as a W3C standard.

10) What is WSDL?

WSDL stands for Web Services Description Language. It is a xml document containing information about web services such as method name, method parameter etc. More details...

11) What is UDDI?

UDDI stands for Universal Description, Discovery and Integration. It is a XML based framework for describing, discovering and integrating web services. It contains a list of available web services. WSDL is the part of UDDI. More details...

12) What is RESTful web services?

REST stands for REpresentational State Transfer. It is a architectural style. It is not a protocol like SOAP. More details...

13) What are the advantages of RESTful web services?

  • Fast
  • Language Independent
  • Platform Independent
  • Can use SOAP.
  • Allows different data format.

12) What is the difference between SOAP and REST web services?

No.
SOAP
REST
1)
SOAP is a protocol.
REST is an architectural style.
2)
SOAP stands for Simple Object Access Protocol.
REST stands for REpresentational State Transfer.
3)
SOAP can't use REST because it is a protocol.
REST can use SOAP web services because it is a concept and can use any protocol like HTTP, SOAP.
4)
SOAP uses services interfaces to expose the business logic.
REST uses URI to expose business logic.
5)
SOAP defines standards to be strictly followed.
REST does not define too much standards like SOAP.
6)
SOAP permits XML data format only.
REST permits different data format such as Plain text, HTML, XML, JSON etc.

13) What is SOA?

SOA stands for Service Oriented Architecture. It is a design pattern to provide services to other application through protocol. More details...

14) What tools are used to test web services?

  • SoapUI tool for testing SOAP and RESTful web services
  • Poster for firefox browser
  • Postman extension for Chrome

15) What is the advantage of XML in web service?

In Web service, an XML is used to tag the data, format the data.

16) What is the usage of WSDL in a web service?

WSDL is used in web service to describe the availability of service.

17) What is Interoperability in Web services?

Web services facilitate various applications to communicate with each other and share data and services among themselves. Other applications can also use the web services. For example, a VB or .NET application can communicate with a Java web services and vice versa. Web services are used to make the application platform and technology independent.

18) Explain the loosely coupled architecture of web services.

A consumer of a web service is not tied to that web service directly. The web service interface can change over time without compromising the client's ability to interact with the service. A tightly coupled system implies that the client and server logic are closely tied to one another, implying that if one interface changes, the other must be updated. Adopting a loosely coupled architecture tends to make software systems more manageable and facilitates simpler integration between different systems.

19) What are the advantages of having XML based Web services?

Using XML eliminates any networking, operating system, or platform binding. So Web Services based applications are highly interoperable application at their core level.

20) What do you mean by synchronicity?

Synchronicity is used to bind the client to the execution of the service. In synchronous invocations, the client blocks and waits for the service to complete its operation before continuing. On the other hand, synchronous operations facilitate a client to invoke a service and then execute other functions.

21) What is the usage of Service Transport Layer in Web service protocol stack?

The Service Transport Layer is used to transport messages between applications.
This layer includes Hyper Text Transport Protocol (HTTP), Simple Mail Transfer Protocol (SMTP), File Transfer Protocol (FTP), and newer protocols like Blocks Extensible Exchange Protocol (BEEP).

22) What is the usage of Service Description layer in Web Service Protocol Stack?

The Service Description layer is used to describe the public interface to a specific web service. Currently, service description is handled via the Web Service Description Language (WSDL).

23) What is the usage of Service Discovery layer in Web Service Protocol Stack?

The Service Discovery layer is used for centralizing services into a common registry and providing easy publish/find functionality.

Currently, service discovery is handled via Universal Description, Discovery, and Integration (UDDI).

Comments

Popular posts from this blog

Mockito interview Questions

1.       Question 1. What Is Mockito? Answer : Mockito allows creation of mock object for the purpose of Test Driven Development and Behavior Driven development. Unlike creating actual object, Mockito allows creation of fake object (external dependencies) which allows it to give consistent results to a given invocation. 2.       Question 2. Why Do We Need Mockito? What Are The Advantages? Answer : Mockito differentiates itself from the other testing framework by removing the expectation beforehand. So, by doing this, it reduces the coupling. Most of the testing framework works on the "expect-run-verify". Mockito allows it to make it "run-verify" framework. Mockito also provides annotation which allows to reduce the boilerplate code. 3.       Question 3. Can You Explain A Mockito Framework? Answer : In Mockito, you always check a particular class. The dependency in that class is injected using mock object. So, for example, if you have service class

JAVA Expert Interview Questions Answers 2017

Java Basics ::  Interview Questions and Answers Home  »  Interview Questions  »  Technical Interview  »  Java Basics  » Interview Questions 1.     What is the difference between a constructor and a method? A constructor is a member function of a class that is used to create objects of that class. It has the same name as the class itself, has no return type, and is invoked using the new operator. A method is an ordinary member function of a class. It has its own name, a return type (which may be void), and is invoked using the dot operator. 2.     What is the purpose of garbage collection in Java, and when is it used? The purpose of garbage collection is to identify and discard objects that are no longer needed by a program so that their resources can be reclaimed and reused. A Java object is subject to garbage collection when it becomes unreachable to the program in which it is used. 3.     Describe synchronization in respect to multithreading. With respect to

Java Example Program to Convert List to Set

import java.util.ArrayList; import java.util.HashSet; import java.util.Set; public class ListToSet {  /**   * @author Amarjit Kumar   * @category interview questions   *   * Description: Convert List to set in java with example program   *   */  public static void main(String[] args) {   ArrayList<String> arrList= new ArrayList<>();   arrList.add("Java");   arrList.add("Java");   arrList.add("List to String");   arrList.add("Example Program");   Set<String> strSet = new HashSet<String>(arrList);   System.out.println(strSet);   System.out.println(arrList);  } } /*  * Java program to convert list to set. Convert ArrayList of string to HashSet  * in java example program How to convert List to Set in java Set<String> strSet  * = new HashSet<String>(arrList); HashSet having a constructor which will take  * list as an argument. Lets see how to convert list to Set using java program.