Category Archives: Best Practices

Attract web traffic with images – 2 Important Points to Remember

How to attract web traffic with images?

Many bloggers, Website owners neglect this valuable source of search engine traffic through images used in their blog or pages in the website.

The most important thing to know is that while people can see our website images,
but not the search engines because they simply cannot read the images. Search engines only read the words in the tags and titles we give in our images.

Two very important points to remember when adding images to the web page:

  1. All images must have ALT and TITLE attributes defined. This is basically the image equivalent of the doc title or meta description for the web page.
  2. We should name the Images with a relevant name.

For example

<img src="tv.gif" alt="Wide Screen Television" title="On Sale Now 50% OFF!" />

Have you found this information is useful? Provide feed,comments or suggestions below

JSF Phase Listeners – Important Points (Short Notes on What When How )

What is JSF Phase Listener?

A Phase Listener is a class that simply implements javax.faces.event.PhaseListener
and registers itself with the JSF implementation and will be invoked before and after each phase
in the JSF lifecycle that the implemented phase listener wants to be notified about



How to Define JSF Phase Listener?
It’s a simply two step process

  •      Write a java class that simply implements javax.faces.event.PhaseListener
  •      Registering it with Java Server Faces in faces-config xml file

     We can implement multiple phase listeners and register in faces config xml file and the order of registration of listeners determines the order in which these listeners will be called during the JSF lifecycle

When to Use?
JSF Phase Listeners can be used to Add Custom processing logic into the JSF lifecycle.
Phase listeners can be used as a perful debugging tool
We can register a listener with the JSF implementation
and the implementation will then notify our listener at both before and after the phase
that our listener is interested in.

Other Notes;
JSF guarantees that if a listener’s beforePhase() method completes successfully,
then its afterPhase() will also be called as normal even if a subsequent listener beforePhase()
method throws an exception. Also important thing to remember is that the JSF Listeners will add
overhead to the JSF lifecycle process and it’s important that we use as appropriate.