Skip to main content

Manfred Riem

I love working with a broad range of technologies. At work it is mostly JavaEE and JavaSE technologies, as a hobby I do some Java on devices.

 

mriem's blog

JSF Tip #25 - The default JSF Converters

Posted by mriem on December 26, 2012 at 7:23 AM PST

Whenever the JSF runtime needs to perform a conversion it uses a Converter to do so. As explained in previous blog entries you have the ability to implement your own Converter. But does that mean you need to implement it for simple conversions? No, you do not, the default JSF converters come to the rescue!

    
  
  

JSF Tip #24 - The JSF State Saving summary

Posted by mriem on December 19, 2012 at 7:14 PM PST

The following blog articles are part of the JSF State Saving series

JSF Tip #23 - The StateHelper API

Posted by mriem on December 15, 2012 at 10:04 AM PST

To facilitate component developers a convenience API was introduced to make it easier to implement the state saving requirements. Access to this API is made available through UIComponent.getStateHelper().

The API defines the following methods:

  void add(Serializable key, Object value) 
  Object eval(Serializable key) 
  Object eval(Serializable key, Object defaultValue) 
    
  
  

JSF Tip #22 - The JSF PartialStateHolder API

Posted by mriem on October 18, 2012 at 8:53 PM PDT

The definition of a PartialStateHolder according to the PartialStateHolder interface:

JSF Tip #21 - The JSF StateHolder API

Posted by mriem on October 17, 2012 at 6:33 PM PDT

The definition of a StateHolder according to the StateHolder interface:

  boolean isTransient()
  void restoreState(FacesContext context, Object state)

  Object saveState(FacesContext context)
  void setTransient(boolean newTransient)

Each of the methods mentioned above have a particular role to fulfill during the JSF lifecycle.

JSF Tip #20 - The JSF State Saving APIs

Posted by mriem on October 16, 2012 at 1:01 PM PDT

Since state saving happens as part of the JSF lifecycle a component, validator, converter, etcetera that wants to participate in state saving can do so by implementing or using one or all of the below mentioned APIs.

  1. StateHolder
  2. PartialStateHolder
  3. StateHelper

StateHolder

JSF Tip #19 - Introduction to JSF State Saving

Posted by mriem on October 16, 2012 at 7:46 AM PDT

During the JSF lifecycle state will be restored at the beginning of a request (if any state is available) and state will be saved at the end of a request (if any state is available).

Why is it important to know what happens during request processing? Well, if you know how JSF state saving works you can optimize your application to perform better.

JSF Tip #18 - The JSF Converter summary

Posted by mriem on October 11, 2012 at 8:01 PM PDT

The following blog articles are part of the JSF Converter series

JSF Tip #17 - Packaging your JSF Converter

Posted by mriem on October 5, 2012 at 7:25 PM PDT

In the previous blog entry you learned how to write your own converter. Say you want to distribute this converter to others. How can you make sure the JSF runtime knows about the converter without needing to add it to the faces-config.xml of the web application.

JSF Tip #16 - Writing your own Converter

Posted by mriem on October 4, 2012 at 3:57 PM PDT

Writing you own converter is a pretty straight forward process. It really comes down to implementing the Converter API.

Say you want to write a converter that will convert colors. Lets assume we support, "Red", "Green" and "Blue".