Spring IoC container types

Spring IoC container is responsible for create, wire, configure and manage objects during their complete life cycle. It uses configuration metadata for create, configure and manage objects. Configuration metadata can be represented by spring configuration xml file or annotations. Types of Spring IoC container: 1. BeanFactory 2. ApplicationContext BeanFactory: BeanFactory org.springframework.beans.factory.BeanFactory is the interface and … Read more

Spring framework architecture modules

Spring framework is designed in modular fashion from which a programmer can choose the applicable modules and ignore the rest. Spring framework modules are divided into categories given below. Spring framework architecture Diagram: 1. Test: Spring test module provides the supports for testing of spring components with JUnit or TestNG frameworks. 2. Core Container: Spring … Read more

JSF managed and backing bean

JSF managed bean: A managed bean is a normal java bean class which contains data and business logic. A managed bean is managed by JSF framework and act as a model for JSF application. Before using a managed bean we have to configure it either in faces-config.xml file or using annotation. JSF backing bean: JSF … Read more

Categories JSF

jsf configuration files

A JSF application needs on the following two configuration files: 1. web.xml 2. faces-config.xml Note: Put the configuration files under WEB-INF folder. web.xml: Example: <?xml version="1.0" encoding="UTF-8"?> <web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">   <servlet> <servlet-name>faces</servlet-name> <servlet-class>javax.faces.webapp.FacesServlet</servlet-class> </servlet>   <servlet-mapping> <servlet-name>faces</servlet-name> <url-pattern>/faces/*</url-pattern> </servlet-mapping>   </web-app><?xml version="1.0" encoding="UTF-8"?> <web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"> <servlet> <servlet-name>faces</servlet-name> … Read more

Categories JSF

JSF bean scopes

Bean Scopes: When we define a bean, we have to define its scope also in which it will be placed. JSF implementation provide us several scope for a bean. Request scope is the default scope. Commonly used bean scopes: 1. Request scope. 2. View scope. 3. Session scope. 4. Application scope. Request scope: In request … Read more

Categories JSF

JSF lifecycle phases

The JSF application consist of six distinct phases given below: 1. Restore View 2. Apply Request Values 3. Process Validations 4. Update Model Values 5. Invoke Application 6. Render Response JSF life cycle diagram:   Restore View: The Restore View is the first phase of JSF life cycle. When a request comes restore view retrieves … Read more

Categories JSF

JSF Framework architecture

In JSF application JavaBean classes are act as a model and contains data and business logic. Commonly a JSP or Facelets (XHTML) page is used for view. JSF components are used to bind the view and model. FacesServlet act as a controller and use component tree to do all task like get request, gathering, validating … Read more

Categories JSF

Java input output tutorial

In Java Input output operations are based on the concept of stream. The java.io package contains all the required classes to perform I/O operations. A stream is defined as a sequence of data. Automatically created streams in Java: System.in: the standard input stream. System.out: standard outputĀ stream. System.err: standard error. Input stream: InputStream is used to … Read more

Java Multithreading Tutorial

Multitasking: Multitasking is a way of executing multiple tasks during the same period of time. Multiple tasks use common resources like CPU and main memory. With a single CPU only one task can be running at one point in time, so the CPU uses context switching to perform multitasking. Context switch (Context means state) is … Read more

Java Exception handling tutorial

Exception: The exception refers to an exceptional event. Exception is an event that disrupts the normal flow of the program, during program execution. Exception object: When an error occurs within a method, the method creates an object and hands it to the runtime system. This object is known as an exception object. It contains the … Read more