Af:table requires the managed bean to be in session scope?

I have let to figure out why af:table requires the managed bean to be in session scope if the af:table has the rows attribute set to anything else but zero.
I'm assuming that in order for the table to hold on and "page" through the range of records that it is a requirement...
Any details on how the under-pinnings really works, would be appreciated.
Thanks,
--Todd                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

Todd,
If you create a table model that you reference from an EL on the table's row variable then this should work with request scope as well. However, I think the problem you would run into is
- performance because the values are getting fetched with every page load
- state, because you would have to persist any change immediately to ensure the next query brings up the change values
Frank

Similar Messages

  • How to pass a value from jspx page to the managed bean

    hi,
    i have created a jspx page and manages bean with page flow scope..
    in my jspx page i am searching a employee record from the data base . and getting entire employee details including 'status' as a search result.
    here i want to pass the value of 'status ' field to the managed bean variable called 'stval'.
    can anybody suggest any solution?.......

    As per the details provided in the post above, when the user clicks on the search in the af:query, the results are populated in the table. And you are interested in getting the value of particular column. This could be done by having the custom row selection listener to get the value of the current row (selected row in the table).
    1) Have a custom selection listener:
    <af:table value="#{bindings.EmpDeptVO.collectionModel}" var="row"
    rows="#{bindings.EmpDeptVO.rangeSize}"
    emptyText="#{bindings.EmpDeptVO.viewable ? 'No data to display.' : 'Access Denied.'}"
    fetchSize="#{bindings.EmpDeptVO.rangeSize}"
    rowBandingInterval="0"
    rowSelection="single" id="t1"
    partialTriggers=":::qryId1 ::ctb1 ::commandToolbarButton1"
    columnStretching="column:c1"
    styleClass="AFStretchWidth" columnSelection="multiple"
    first="0" contentDelivery="immediate" autoHeightRows="10"
    binding="#{pageFlowScope.ExampleBean.searchResultsTable}"
    *selectionListener="#{pageFlowScope.ExampleBean.rowSelected}">*
    2) In the method, set the current row programmatically:
    ADFUtil.invokeEL("#{bindings.EmpDeptVO.collectionModel.makeCurrent}",
    new Class[] { SelectionEvent.class },
    new Object[] { selectionEvent });
    3) Get the current row and get the required attribute values and set it in any of the variables in the managed bean:
    Row selectedRow =
    (Row)ADFUtil.evaluateEL("#{bindings.EmpDeptVOIterator.currentRow}");
    String status = selectedRow.getAttribute("Status");
    Thanks,
    Navaneeth

  • How do I set the CoreTable sort column in the managed bean?

    I have a CoreTable with two columns, first name and company, from the managed bean in a session scope, how do I set the company column to be the default/selected sort order?
    Or is that done by binding the af:column to a CoreColumn object in the managed bean, which method would I use?
    <af:column sortProperty="company" sortable="true">
    <f:facet name="header">
    <af:outputText value="#{common.labelCompany}"/>
    </f:facet>
    <af:outputText value="#{row.company}"/>
    </af:column>
    Thanks,
    --Todd                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    Yes, I know, "sortable", see, I even used it in my example. I don't want to disable default sorting.
    What I'm asking is how to have more than one sortProperty. When the user clicks the column heading, I want to sort by "myFirstProperty" AND "mySecondProperty". The sortProperty only seems to allow one sort property.
    One possibility seems to be to programatically add items to the List of SortCriterion objects as in your example, but where would I put this code so that it is executed when the user clicks the column heading, but before the table is sorted.

  • The Managed Bean in the faces-config.xml File

    I am still very new to JSF. I am confused about the managed bean.
    For example, I have a button in my web page. A click on this button invokes an action; say, ListAction.java.
    In this ListAction class, I instantiate a business delegate; say, ListPersonnel.java and call a method in this business delegate to return an ArrayList: personnel. Of course, this business delegate goes through facade, DAO, etc. to populate the ArrayList. This ArrayList is a collecation of a JavaBean called PersonnelBean that gets and sets a number of personnel information; such as ssn, name, etc.
    Upon this ArrayList is successfully populated and received by the ListAction class, I am going to display a web page with a table. In JSF, it is <h:dataTable ...>.
    My questions are regarding the managed bean in the faces-config.xml file.
    1. Which one is my <managed-bean-class>? packageName.ListAction? or packageName.PersonnelBean? or something else?
    2. What should be my <managed-bean-name>? I guess that I can give a name I like. Is it right? What about xyz?
    3. Then, how do I specify the "value" attribute of my <h:dataTable ...> tag when I display a web page to show the data table? Is it correct to specify value="#{xyz.personnel}"? What is the correct specification if it is wrong?
    4. I guess that I can give any name to the "var" attribute in the <h:dataTable ...> tag. Is it right?

    1. Which one is my <managed-bean-class>?
    packageName.ListAction? or
    packageName.PersonnelBean? or something else?ListAction
    2. What should be my <managed-bean-name>? I guess
    that I can give a name I like. Is it right? What
    about xyz?Anything you like. xyz is OK.
    3. Then, how do I specify the "value" attribute of my
    <h:dataTable ...> tag when I display a web page to
    show the data table? Is it correct to specify
    value="#{xyz.personnel}"? What is the correct
    specification if it is wrong?xyz.personnel is OK assuming that ListAction class has a public
    method getPersonnel() which returns the ArrayList of PersonnellBeans.
    4. I guess that I can give any name to the "var"
    attribute in the <h:dataTable ...> tag. Is it right?Yes, you can give any name you like.

  • How can we contrrol the focus of an form Object  from the Managed bean??

    I am getting the following script error...
    Can't move the focus to the control because it is invisible or not enabled or of the type that does not accept the focus...
    I have a button whose action is mapped to a function in the Managed bean.
    In the managed bean
    I am making the button Invisible along with some other components.
    Can any one help me out....

    @BalusC
    You were proposing the following solution in other thread..
    <html>
    <head>
    </head>
    <body>
    <f:verbatim>
    <script>
    setFocus('</f:verbatim><h:outputText value="#{myBean.focusId}" /><f:verbatim>');
    </script>
    </f:verbatim>
    </body>
    </html>
    But it is giving the following error
    javax.faces.FacesException: org.apache.jasper.JasperException: /EducationDetails.jsp(97,29) The element type "script" must be terminated by the matching end-tag "</script>".

  • Managed Bean "Name" Access  with in the Managed Bean

    Hi,
    I have faces-config.xml in which I have registered a managed bean
    and I have a base class for all the managed bean.
    The JSP's invoke the action/method defined in the base bean and I want to remove the managed bean from session upon a particular event.
    To remove the managed bean from session, as far as I know - we need to know the managed-bean-name in the faces config.
    I wanted to know if there is any way to get the name of the managed bean in the faces-config.xml at run time?.
    Thanks,

    Thanks for your recommendations. The issue that I get stuck on is how to call this method that retrives employee data. When I had the code in the constructor, it executed when I accessed the view.jsp page. Then I populated the fields from the Employee class fields. But once I create non-constructor method, how do I invoke it from my JSF page.

  • Setting bind variable for a view object from the Managed Bean

    Hi,
    i am using JDeveloper 11g, i have to create LOV in the JSF. To show the LOV, it has to populate data using View object and its query parameter need to be sent from the Managed Bean.
    For the View object i want to set the bind variable parameter from the managed bean value. bename is stored in a managed bean (session scope)
    #{beantest.bename}
    But it gives the following exception.
    JBO-29000: Unexpected exception caught:
    org.codehaus.groovy.control.MultipleCompilationErrorsException,msg=startup failed, Script1.groovy: 1: expecting '!',found '{'@ line1, column 2.
    I have followed the link http://kr.forums.oracle.com/forums/thread.jspa?threadID=615474 like Frank wrote on 8.2.2008:
    But steps are not clear.
    How to input the VO bind parameter with Managed bean variable?
    Any Help
    Regards
    Raj
    Edited by: user9928180 on Dec 17, 2008 9:51 AM

    Hi,
    a bind variable in a VO needs to be exposed as an executeWithParams operation in the pageDef file. Just add a new action binding to the pageDef file (context menu) and select the executeWithParams operation on teh VO. Then in the argument field, reference the managed bean property for the value
    Frank

  • How to clear the Managed Bean Values prior to load a JSF page

    Hello.
    I have a jsf page that contains fields that need to be cleared BEFORE the page is loaded.
    My managed bean where the fields are linked (I�m using the value attribute) is in the SESSION scope because I need to control they values across a popup window and if I use request scope, my vectors that load objects like dataTable are cleared when I post the form.
    My question is :
    How I CLEAR all the values in the managed bean BEFORE the page is loaded ???
    In the WebForms (Microsoft .NET) I have an method on the codebehind called Page_Load where I put my initialization code for my page.
    Thanks in advance.
    Rog�rio

    Rog�rio,
    You can do this with a PhaseListener. Just regiser a new listener for the RESTORE_VIEW phase, and implement the beforePhase method; you can do this in the backing bean's constructor, or somewhere elase. This is pretty much the same as the Page_Load event handler in .NET.
    Kito D. Mann
    Author, JSF in Action
    http://www.jsfcentral.com - JSF news, info, and FAQ
    Hello.
    I have a jsf page that contains fields that need to be
    cleared BEFORE the page is loaded.
    My managed bean where the fields are linked (I�m using
    the value attribute) is in the SESSION scope because I
    need to control they values across a popup window and
    if I use request scope, my vectors that load objects
    like dataTable are cleared when I post the form.
    My question is :
    How I CLEAR all the values in the managed bean BEFORE
    the page is loaded ???
    In the WebForms (Microsoft .NET) I have an method on
    the codebehind called Page_Load where I put my
    initialization code for my page.
    Thanks in advance.
    Rog�rio

  • How to obtain the manage beans instance to oprate it in javacode

    in the faces,there is some manage bean, but i what to operate it ,eg: carbean.carName = "xxxx"; carbean is a managed bean:
    How to obtain the manage beans instance to oprate it in javacode

             ActivityContentBean activityContentBean = (ActivityContentBean) FacesContext
                        .getCurrentInstance().getApplication().createValueBinding(
                                  "#{currentActivity}").getValue(
                                  FacesContext.getCurrentInstance());

  • Where in Debug tree are the management beans?

    Hi I'm trying to verify some property settings of a Management bean during a debug session (that does not use methods). Does anyone know where in the tree the properties of a management bean would be held (if at all). Please advise. Thanks!

    Actually not. That page has the same or even less information compared to the "Add Role" wizard from Server Manager GUI. Not helpful at all. However, from the two what I can gather is there is no native mechanism in Server 10 to manage the Network
    Controller role or the data it surfaces. One is left to either purchase ($$$) and use other software or roll your own (possible??). 
    Looking at the files installed by Canary, I doubt if even this is possible with Canary because it just seems to be a set of services...
    Sujay Sarma {Unbounded;} Blog: http://blog.sujay.sarma.in

  • How to get  h:datatable rows in the managed bean

    Hi All,
    I am showing a table with some columns in a page. I have submit button in that page.
    After submission of page,I need to get the rows displayed in the page.
    how can i acheive it?
    is binding attribute helps?
    please provide some info..
    thanks in advance..
    chenna........

    BalusC,
    thanks for ur reply..
    Let me reframe my question..
    here is my code snippet..
    // bean
    private ArrayList<MyVO> myList;
    // setter and getter methods for myList......
    ArrayList<MyVO> getRows(){
    resultFromDB=getMyRows();// call getMyRows() DAO method for results
    this.myList=resultsFromDB;
    return resultFromDB;
    In the jsp and displaying all the rows using<h:datatable id="someId" value="#{someBean.rows}"
    so far good.
    In this page i have one submit button which will call confirm() of my managed bean.
    In the confirm() i need to get all the rows. i.e; i need to get the myList.
    I dont want to call the getRows() method again(since it is DB hit)
    But myList is empty in my confirm method.
    my managed bean is in request scope.
    if i change it to session it is working.but i need request scope only.
    I tried with <t:saveState value="#{someBean}" /> but no luck..
    Later i have taken HtmlDataTable reference with setter and getters in the bean and bind this reference in <h:datatable>.
    and tried to disply the htmlDataTable rowCount...
    then im getting NotSerializableException though my bean is implementing Serializable interface..
    Please give some suggestion in this
    thanks....

  • Reset JSF session and the managed beans with sesison scope

    Hi,
    this is a very general question and maybe stupid for most of you. I have my jsf/facelets web application and i use inside of this application some managed beans, which are session beans. I want to know how is it possible to reset this beans. I'm asking this question beacuse i have this kind of problem: i built my web application which has a login form and i use the browser to test it. When i browse to the login page and I login with my credentials i get my customized home page. Then i open another istance of the browser and i browse to the login page again but this time i login as a different user. The result home page is the same as i got before with my login credentials, so the session is always the same. Instead i want the session and all its objects to be resetted for the new user! Do youn know which is the solution?

    The fact is that i want to have two sessions in parallel, so using the same browser and opening two tabs, i want to browse to the login page and access as two totaly different users and using in parallel the application without the problem of one user's action affecting the other user beacuse of session sharing. So I want to force the application to create two different session for the two users logins, because as i told you before as it is now, they are sharing the same sesison. And i think that if i at the login time I iterate thorugh the session and delete all the objects i will be able to have only one session per time. Isn't it?

  • In which table does the Manage Rejection data is stored

    Hi All,
    I need some information regarding Manage Rejection.
    In which table is Rejected users data is stored. Actually what I am looking for is to look at the comments of all the rejected users by the reviewers.
    Currently I need to go into each and every request for the comments of reviewers.
    I searched for any specific table on the net but was able to find any.
    Please any help in this regard is appreciated.
    Regards,
    Nisha

    Dear Nisha,
    you can use table GRACREVREJUSER with the correpsonding reasons from table GRACREJREASON and GRACREJREASONT.
    Regards,
    Alessandro

  • About Using the managed-bean Element

    Initializing Managed Bean Properties
    why referenced bean can't instantiate? Please help.
    <managed-bean>
    <managed-bean-name>customers</managed-bean-name>
    <managed-bean-class>test.Customers</managed-bean-class>
    <managed-bean-scope> session</managed-bean-scope>
    <managed-property>
    <property-name>mailingAddress</property-name>
    <value>addressBean</value>
    </managed-property>
    </managed-bean>
    managed-bean>
    <managed-bean-name>addressBean</managed-bean-name>
    <managed-bean-class>test..AddressBean</managed-bean-class>
    <managed-bean-scope> none </managed-bean-scope>
    </managed-bean>

    Hi,
    Maybe this helps:
    When you create an object that points to other objects, do not try to point to an object with a shorter life span.
    A scope of "none" means that the bean is created only when something else references it.
    The life span is in this order: none, application, session, request .
    Best regards,
    Nick

  • Accessing property of one managed bean to another in request scope

    Right now my applications managed beans are in session scope.
    I want to change them to request scope .But the problem is how to access the bean methods to another if they are in request scope

    Use RequestMap instead of SessionMap.
    Having multiple and independent managed beans in the request scope for 1 request and the need to access the other bean is somewhat odd design however. You may need to rethink about it. For example, add one of the beans as property of the other bean.

Maybe you are looking for