ArticlesTutorialsInterview Questions & AnswersCertificationsFree Books & Sample ChaptersTechnical Discussions  Your Account | Advertise with us | Feedback |
Few pages of this site are under construction and we are constantly trying to improve it. If you have any suggestions or ideas about how to improve the site, please Let us know.
Tomahawk Savestate

 t:radio Tomahawk Tag Home t:schedule 

<t:saveState>


Contents

  1. Introduction
  2. Tag Attributes
  3. Example

Introduction

The t:saveState enables you to persist beans and values longer than request scope, but shorter than session scope. It is ideal for persisting backing beans and values with the same scope as your view components. It does this by saving the target state with the component tree.

Note :

  • t:saveState is powerful and flexible mechanism.
  • Eliminates initialization problem:
    • Values are restored in the beginning of the lifecycle
  • Can save simple values and whole beans
    • As long as they are Serializable
  • Use it with care:
    • Saved state can become hard to trace
  • Saved state can become hard to trace



Tag Attributes


AttributeDescription   Type    
binding The value-binding expression linking this component tag to a backing bean property.String
id The unique identifier value for this component. The value must be unique within the closest naming container (e.g.,h:form or f:subview).This value must be a static value.String
renderedA boolean value that indicates whether this component should be rendered.Default value: true.String
value(required)The value attribute sets the current value for this component.String


Example



<t:saveState id="save1" value="#{myBean.number1}"/>
<t:saveState id="save3" value="#{MyForm.text}" />

The current values of the properties number1, and text are automatically saved within the client response and get restored at the next client request. You can also save the whole bean.



<t:saveState id="saveBean" value="#{myBean}" />


The whole bean automatically is saved and restored by MyFaces. To be able to save and restore the value of a bean property or the bean itself, it must implement the Serializable interface.

 t:radio Tomahawk Tag Home t:schedule 
Test

  ALSO SEE :

About Us | Our Mission | Terms of use | Author Terms |    Search        | Contact Us | Advertise With Us | Link to Us | Sitemap
Copyright © 2016 developersBOOK.COM. All rights reserved.