myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <wikidi...@apache.org>
Subject [Myfaces Wiki] Update of "FAQ" by SimonKitching
Date Wed, 30 Nov 2005 20:16:35 GMT
Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Myfaces Wiki" for change notification.

The following page has been changed by SimonKitching:
http://wiki.apache.org/myfaces/FAQ

The comment on the change is:
Add entry about DataModel and Serializable

------------------------------------------------------------------------------
  For releases of the !MyFaces JSF implementation (myfaces-api and myfaces-impl jars), a change
to the third digit of the release number does
  indicate a binary-compatible release, as the JSF specification number has not changed. All
code using JSF-specified features will continue
  to work as previously (unless the previous behaviour was buggy).
+ 
+ === Why isn't DataModel serializable? ===
+ 
+ The !DataModel class (used with UIData components) doesn't have any state that needs to
be preserved between render and restore-view phases.
+ Therefore, there is no need for it to be serializable.
+ 
+ If you have a managed bean that you want to be serializable, and there is a member of type
!DataModel then just mark it transient.
+ 
+ If you want to serialize the list within the !DataModel along with the managed bean, then
do this:
+ {{{
+ public class SomeManagedBean implements Serializable {
+   private List myData;
+ 
+   private transient DataModel myDataModel;
+ 
+   public DataModel getDataModel() {
+     if (myDataModel == null) {
+       myDataModel = new ListDataModel(myData);
+     }
+     return myDataModel;
+   }
+ }
+ }}}
  
  === How can I access one Managed Bean from another? ===
  [#Bean permlink]

Mime
View raw message