Skip to main content

JSF Spring Integration Steps

JSF-Spring integration is very straightforward and simple to do.


Step 1 – Changes in Web.xml


Your Web Application need to be aware of Spring's Web Application Context. This is defined in the Web.xml.  


<listener>

<listener-class>

org.springframework.web.context.ContextLoaderListener

</listener-class>

</listener>


Your Web Application also needs to know the location of Spring Beans. Definition of one or more "contextConfigLocation" does exactly this job.


<context-param>

<param-name>contextConfigLocation</param-name>

<param-value>classpath*:/applicationContext.xml </param-value>

</context-param>


The above statement makes it possible to load classless from applicationContext.xml, which is in the classpath.


Step 2 -  Define Beans in applicationContext.xml


Below is an example of applicationContext.xml


<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN"

"http://www.springframework.org/dtd/spring-beans.dtd">

<beans>

<bean id="destinationService" class="com.cyberworkz.leisure.services.DestinationServiceImpl">

</bean>

</beans>


Step 3 Changes in the FacesConfig.xml


Variable names in JSF are resolved by "Resolvers". For every "bean" that is declared in the faces-config.xml, JSF resolver will try to construct and associate the object with the identifier. Now that we are using Spring, we have to let JSF Framework know that instead of the default JSF resolver, Spring resolver should be used. Spring's distribution comes with a pre-defined Variable resolver called org.springframework.web.jsf.DelegatingVariableResolver. The following declaration in faces-config.xml will do exactly that:


<application>

<variable-resolver>

org.springframework.web.jsf.DelegatingVariableResolver

</variable-resolver>

</application>


And that’s all we need to do.

Comments

Popular posts from this blog

SAAS Simple Maturity Model

There are two architectural models – commonly referred as SAAS Maturity models- that describe the transition of a service to what is called Multi-tenant efficient, highly scalable application. The SAAS Maturity model described by Microsoft has four distinct stages and is illustrated below. Another similar well-known model for SaaS-maturity is known as Forrester-model but adds another stage known as "Dynamic Business Apps-as-a-service". The three key Attributes of a SAAS Architecture: Configurability: Metadata used to configure the way the application behaves for customers Multi-tenant Efficiency : Maximizing the sharing of resources across tenants Scalability: Maximizing concurrency, resource efficiency SAAS Simple Maturity Model (Microsoft, 2006) SaaS Maturity Model (Forres

What is an ESB?

ESB is another of these amorphous terms that means different things to different people. An ESB can be thought of as the next generation of Service Oriented Architecture. Everybody knows web services today, and they have been used extensively to allow companies to break the tyranny of proprietary architectures. Now you can wire applications to service providers without having to know or worry about the provider's underlying operating system or programming language. It is an architectural concept/construct - not a technology, despite some vendors (and even gartner) telling you otherwise. You'll find many different types of technology can fulfil the conceptual role of an ESB, hence be careful not to associate it with a particular technology. Therefore designing the architecture is more important than choosing a 'product'. An Enterprise Service Bus (ESB) is the "backbone" of the service-oriented architectural model which allows different protocols to be communica

Web Service Framework comparison

Web Services is one of those concepts made all the more difficult to understand because of the myriad acronyms and abbreviations that are superfluous in any discussion. Covering all the concepts and standards associated with Web Services is a vast topic in itself. There are a large number of standards around Web Services. These standards define the norms of a Web Services implementation and ensure that a Web Services is accessed independently of the client platform. There are numerous frameworks available to select to build web service today. Below is the most widely used ones. Product Does it fit my need? Axis2.0 Apache Axis2 is a complete re-design and re-write of the widely used Apache Axis SOAP stack to build on the lessons learnt from Apache Axis. An advantage of Axis 2 is its support for the binding frameworks XMLBeans. Axis 2 with XMLBeans is widely