JSF- Managed Beans
Managed Bean is a regular Java Bean class registered with JSF. In other words, Managed Beans
is a Java bean managed by JSF framework. Managed bean contains the getter and setter methods,
business logic, or even a backing bean (a bean contains all the HTML form value).
Managed beans works as Model for UI component. Managed Bean can be accessed from JSF page.
In JSF 1.2, a managed bean had to register it in JSF configuration file such as [Link].
From JSF 2.0 onwards, managed beans can be easily registered using annotations. This approach
keeps beans and its registration at one place hence it becomes easier to manage.
Using XML Configuration
<managed-bean>
<managed-bean-name>helloWorld</managed-bean-name>
<managed-bean-class>[Link]</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>
What is JSF? JavaServer Faces (JSF) is a MVC web framework that simplifies the construction of User
Interfaces (UI) for server-based applications using reusable UI components in a page. JSF provides
a facility to connect UI widgets with data sources and to server-side event handlers. The JSF
specification defines a set of standard UI components and provides an Application Programming
Interface (API) for developing components. JSF enables the reuse and extension of the existing
standard UI components.
Benefits JSF reduces the effort in creating and maintaining applications, which will run on a Java
application server and will render application UI on to a target client. JSF facilitates Web
application development by −
Providing reusable UI components
Making easy data transfer between UI components
Managing UI state across multiple server requests
Enabling implementation of custom components
Wiring client-side event to server-side application code
JSF Lifecycle JSF application life cycle consists of six phases which are as follows –
1. Restore view phase
2. Apply request values phase; process events
3. Process validations phase; process events
4. Update model values phase; process events
5. Invoke application phase; process events
6. Render response phase
JSP JSP technology is used to create web application just like Servlet technology. It can be thought
of as an extension to Servlet because it provides more functionality than servlet such as
expression language, JSTL, etc.
A JSP page consists of HTML tags and JSP tags. The JSP pages are easier to maintain than
Servlet because we can separate designing and development. It provides some additional
features such as Expression Language, Custom Tags, etc.
Hibernate Introduction Hibernate is a framework which provides some abstraction layer, meaning that the programmer
does not have to worry about the implementations, Hibernate does the implementations for you
internally like Establishing a connection with the database, writing query to perform CRUD
operations etc. It is a java framework which is used to develop persistence logic. Persistence
logic means to store and process the data for long use. More precisely Hibernate is an open-source,
non-invasive, light-weight java ORM(Object-relational mapping) framework to develop objects
which are independent of the database software and make independent persistence logic in all
JAVA, JEE. Framework means it is special install-able software that provides an abstraction
layer on one or more technologies like JDBC, Servlet, etc to simplify or reduce the complexity
for the development process. Open Source means:
Hibernate framework is available for everyone without any cost.
The source code of Hibernate is also available on the Internet and we can also modify the code
Introduction to AJAX
Ajax is an acronym for Asynchronous Javascript and XML. It is used to communicate with
the server without refreshing the web page and thus increasing the user experience and better
performance. It is a group of inter-related technologies like JavaScript, DOM, XML,
HTML/XHTML, CSS, XMLHttpRequest etc.
Introduction of Junits
What is JUnit ?
JUnit is a unit testing framework for Java programming language. It plays a crucial role test-driven
development, and is a family of unit testing frameworks collectively known as xUnit.
JUnit promotes the idea of "first testing then coding", which emphasizes on setting up the test data
for a piece of code that can be tested first and then implemented. This approach is like "test a little,
code a little, test a little, code a little." It increases the productivity of the programmer and the
stability of program code, which in turn reduces the stress on the programmer and the time spent
on debugging.
Features of JUnit
JUnit is an open source framework, which is used for writing and running tests.
Provides annotations to identify test methods.
Provides assertions for testing expected results.
Provides test runners for running tests.
JUnit tests allow you to write codes faster, which increases quality.
JUnit is elegantly simple. It is less complex and takes less time.
JUnit tests can be run automatically and they check their own results and provide
immediate feedback. There's no need to manually comb through a report of test results.
JUnit tests can be organized into test suites containing test cases and even other test
suites.
JUnit shows test progress in a bar that is green if the test is running smoothly, and it turns
red when a test fails
Maven is a powerful project management tool that is based on POM (project object model). It
is used for project build, dependency, and documentation. It simplifies the build process like
ANT. But it is too much more advanced than ANT. In short terms we can tell maven is a tool
that can be used for building and managing any Java-based project. maven makes the day-to-day
work of Java developers easier and generally helps with the comprehension of any Java-based
project.