July 14 2016

Java compareToIgnoreCase example

Java compareToIgnoreCase example

The method ‘compareToIgnoreCase’ compares two strings ignoring case differences. It is similar to the ‘compareTo’ method, ‘compareTo’ method compares two strings with respect to case.


int compareToIgnoreCase(String str)

Return type

The return type of the method is integer. If the return value is

  • >0 current string is greater than input string
  • =0  both the strings are equal
  • <0 current string is less than input string

Example Continue reading

July 1 2016

javax faces project stage configuration

javax faces project stage configuration

If you are working with JSF project, you should enable the ‘PROJECT STAGE’ for better performance. Project stage in JSF can be configured in web deployment descriptor file (web.xml) as context param.





The possible Project Stage values are Continue reading

Category: Jsf | LEAVE A COMMENT
June 23 2016

Jsf download file example

Jsf download file example

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"

<title> Jsf File Download </title>



<h3> Jsf File Download </h3>

<h:commandButton value="Submit" actionListener="#{jsfFileDownload.download}" />



Continue reading

Category: Jsf | LEAVE A COMMENT
June 16 2016

JSF managed property

JSF managed property is used to access one managed bean in other managed bean (Dependency Injection).Managed property can be configured using @ManagedProperty annotation or by adding <managed-property> to <managed-bean> in faces-config.xml

In the below example, ‘requestManagedBean’ managed bean have managed property for ‘verificationManagedBean’ managed bean

Note Continue reading

Category: Jsf | LEAVE A COMMENT
December 28 2015

Spring MVC Dispatcher Servlet

Spring MVC Dispatcher Servlet

Spring Web MVC framework is designed around the Front controller which is DispatcherServlet. DispatcherServlet is a servlet implemented as a subtype of HttpServlet. It is responsible for initializing the Spring Web MVC framework.

DispatcherServlet listens to the incoming requests and dispatches the request to handler,configurable handler mapping, view resolvers, local and theme resolvers. It has to be configured in web.xml Continue reading

Category: Spring | LEAVE A COMMENT
October 28 2015

Jsf interview questions and answers for experienced

JSF interview questions and answers for experienced

What is JSF?

JSF provides set of API’s which represents different UI Components and helps in managing state,handling events and validate user input. JSF is based on MVC architecture.

What are the different phases of JSF request processing life cycle?

There are six phases in JSF request processing life cycle

  • Restore View
  • Apply requests
  • Process Validations
  • Update model values
  • Invoke applications
  • Render response

Continue reading

October 19 2015

Jsf setpropertyactionlistener example

Jsf setpropertyactionlistener example

Jsf ‘<f:setPropertyActionListener>’ tag creates a special action listener and registers with the associated action. It sets value specified by ‘value’ attribute to ‘target’ attribute.It is generally used in datatable to get the record selected by the user.

Attribute          Value expression
value                store the value of target attribute
target               defines the destination of value attribute

In the below example, the ‘stud’ property is set to student property of the studentBean. This will take place before editStudent method is executed. Continue reading

Category: Jsf | LEAVE A COMMENT
September 23 2015

Spring factory bean attribute

Spring factory bean attribute

A spring bean can be instantiated using non static factory method. A method that returns instance of a class is called factory method. The spring container uses the non-static factory method to instantiate the bean.

The bean of the factory method’s class has to be specified using ‘factory-bean’ attribute and the factory method name has to be specified using ‘factory-method’ attribute of the bean element.

<bean id=”employeeFactory” class=”com.answersz.factorymethods.EmployeeFactory” />

<bean id=”employeeService” factory-bean=”employeeFactory” factory-method=”getEmployeeService” />

Example Continue reading

Category: Spring | LEAVE A COMMENT