JSF implicit navigation rule

An action can directly return a string or can call a managed bean method which returns a string. JSF implicit navigation when action directly returns a string. Example explanation: When “Say Hello” button is clicked it returns the “welcome” string. JSF framework embed the .xhtml at the end of the return string and display the … Read more

Categories JSF

JSF navigation rule tutorial

Navigation: Navigation in programming is way of transferring the control from one view to another. Navigation rules in JSF framework: JSF framework defines some navigation rules based on those view is render after an action is performed. A navigation rule can be defined in JSF configuration file faces-config.xml or in managed bean. JSF 2 framework … Read more

Categories JSF

JSF managed property annotation

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. @ManagedProperty: The @ManagedProperty annotation … Read more

Categories JSF

JSF 2 annotations example

Let us discuss JSF annotations with below example. Example explanation: Create a managed bean class “HelloWorld.java” which is used for interacting with User Interface and business logic. HelloWorld.java contains the getter method of message property. The @ManagedBean annotation property specify the managed bean name. The @SessionScoped annotation specify the scope of the managed bean. Insert … Read more

Categories JSF

JSF ajax hello world example

Ajax: AJAX refers to Asynchronous JavaScript and XML. It provides the following features: 1.Exchanging the data between web page and server with reloading the webpage. 2.Updating the parts of web page without refreshing or reloading the whole web page. JSF use f:ajax tag to perform ajax operations. Syntax: <f:ajax execute="inputComponentId" render="outputComponentId" /><f:ajax execute="inputComponentId" render="outputComponentId" /> … Read more

Categories JSF

JSF hello world example in eclipse

Let us start JSF programming with simple hello world example. Example explanation: Create a managed bean class “HelloWorld.java” which is used for interacting with User Interface and business logic. HelloWorld.java contains the getter method of message property. Register the managed bean class into faces-config.xml and provide the details like name and scope etc. Insert the … Read more

Categories JSF

Spring callback methods

Callback method: A callback method in java is a method which is called when an event occurs. Normally we can implement that by passing an implementation of a certain interface to the system which is responsible for triggering the event. Commonly used callback methods in spring: Post-initialization callback methods: Using InitializingBean interface: The InitializingBean interface … Read more

Spring bean life cycle

Spring bean life cycle: As we discussed earlier spring IoC container is responsible to create, configure and manage objects during their complete life cycle using configuration metadata. See the below points to understand the spring bean life cycle. Bean lifecycle in spring framework: 1. Spring container finds the bean definition from configuration file. 2. Spring … Read more

Spring bean scopes

Spring bean scopes: As we discussed that spring container is responsible for creating and managing bean object. Spring provides the facility to return the same instance or a new instance each time when one is needed. It depends upon the bean scope. Spring framework bean scopes: Bean Scope Description 1. singleton It scopes the bean … Read more

Spring bean

A spring bean represents an object that is created, configured and managed by spring container. A spring bean is created by configuration metadata passed to the spring container which tells the container about bean creation, bean lifecycle and bean dependencies. Spring bean properties: Bean Properties Description 1. class It is mandatory and specify the bean … Read more