1

Can i use immediate property in JSF to refresh my html page without calling any backing bean methods?? i am new to jsf please suggest & also explain use of immediate

Niraj Dave
  • 117
  • 2
  • 10

3 Answers3

0

Use reRender attribute by using richfaces components for refresh the page or particular region of a page.

UdayKiran Pulipati
  • 6,579
  • 7
  • 67
  • 92
  • i have multiple pages , having multiple dropdown ,input text ,by changing the dropdown value rendering of some of the fields will be changing ,any idea where i can use immediate here? – Niraj Dave Apr 30 '13 at 10:09
  • use component for refresh the page, and mention the target component id in reRender attribute. You may change the event 'onchange' in a4j support component based on the operations you need to perform. – UdayKiran Pulipati Apr 30 '13 at 10:16
  • tag is fine but i have been told to find some ways how can i use immediate to reduce backend bean calls & refresh the page faster...any idea?? – Niraj Dave Apr 30 '13 at 11:51
0

Imagine that you have this code:

<h:form>
    <h:selectOneMenu id="subscriptions"
                     value="#{subscriptionController.subscriptions}" 
                     immediate="true">
        <f:selectItem id="item1" itemLabel="News" itemValue="1" />
        <f:selectItem id="item2" itemLabel="Sports" itemValue="2" />
        <f:selectItem id="item3" itemLabel="Music" itemValue="3" />
        <f:selectItem id="item4" itemLabel="Java" itemValue="4" />
        <f:selectItem id="item5" itemLabel="Web" itemValue="5" />
    </h:selectOneMenu>
</h:form>

Regarding the immediate attribute is a boolean flag indicating that component events should be sent to registered event listeners immediately rather than after the validation phase of the JSF request processing lifecycle. The immediate flag allows you bypass JSF validation for a particular component. Reference here.

JSF life cycle is not easy to understand but you can check a good explanation here: JSF Life cycle

At a next level of experience you can add ajax to improve even more your performance. And the most recommended is to use libraries in that case, for example RichFaces and PrimeFaces.

Regards,

Community
  • 1
  • 1
Rodmar Conde
  • 956
  • 1
  • 12
  • 24
0

According to your requirement it seems that you don't need to use immediate attribute.

Just use f:ajax to process(execute) and update(render) particular elements or group of elements. It will not harm the performance.

And to know JSF Lifecycle and detail of immediate attribute please check Baluc's Blog

Jitesh
  • 1,384
  • 10
  • 20