Create backing bean after page created - 11g

Is there a way in JDev 11g to create a backing bean (bb) for a page fragment after the page fragment is created?
I know you can create the bb a time of page creation, but how about after then?

I have an editable form that is showing values for the current row.
When I click 'CreateInsert' with immediate="true" (to avoid validation) the old values stay populated in the form. I want to clear the values so the form comes back empty on refresh.
I figured that I would add an actionListener method on the backing bean in which I programmatically set the submitted values to null (those values coming in on the request from the current row).
I started the following thread to solve a problem, which lead to this thread:
stop client validation (11g)

Similar Messages

  • Is there any way to create backing bean, After page gets created?

    Hi
    Any one can please answer to my quick question !!!
    Is there any way to create the backing bean ,after a jsf page gets created using ADF ..?
    When i first time created the jsf jppx page i unchecked the option to generate backing bean, but later some time I would like to have backing bean for the newly created page. so is there any way to create backing bean ...?
    Thanks in Advance

    Have your page in the visual design mode then go to the Design->Page Properties menu and you'll be able to select auto-bind on the second tab.

  • Is it possible to trigger action in backing bean on page unload event?

    Hi,
    There is a RichPopup in my page which has a Listener to save data or not by user choice "Data change detected, do you want to save those changes?"
    I've tried with the javascript event 'window.onbeforeunload', but this way must be fit with a Servlet function which I am not allowed to use.
    The attibute 'onunload' in the tag '<af:document>' seems useless. Even there is few description or example in the 'Tag Reference'.
    So, is it possible to trigger action in backing bean on page unload event? Thanks in advance for helping.
    Viva

    Hi Frank
    Thanks for helping, I've tried in your way. My codes are like below:
    Page codes:
    <?xml version='1.0' encoding='UTF-8'?>
    <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"
              xmlns:f="http://java.sun.com/jsf/core"
              xmlns:h="http://java.sun.com/jsf/html"
              xmlns:af="http://xmlns.oracle.com/adf/faces/rich">
      <jsp:directive.page contentType="text/html;charset=UTF-8"/>
      <f:view>
        <af:document id="d1" clientComponent="true" title="viva test">
          <af:resource type="javascript">
            if (!window.addEventListener) {
                // alert('window.addEventListener is not supported in IE8. Override it!');
                window.addEventListener = function (type, listener, useCapture) {
                    window.attachEvent('on' + type, function() {listener(event)});
            window.addEventListener('beforeunload', function (){performUnloadEvent()}, false);
            function performUnloadEvent() {
              var eventSource = AdfPage.PAGE.findComponentByAbsoluteId('d1');
              //var x and y are dummy variables obviously neeed to keep the page
              //alive for as long it takes to send the custom event to the server
              var x = AdfCustomEvent.queue(eventSource, 'handleOnUnload', {args:'noargs'}, false);
              var y = 0;
          </af:resource>
          <af:serverListener type="handleOnUnload" method="#{vivaTestBean.testOnUnload}"/>
          <!--
          <af:form id="f1">
            <af:commandButton text="Unload" id="cb1" action="unload"/>
          </af:form>
          -->
        </af:document>
      </f:view>
    </jsp:root>The backing bean codes:
    public class VivaTestBean {
        public VivaTestBean() {
        public void testOnUnload(ClientEvent clientEvent) {
            System.out.println("Thanks God");
    }The first way which triggers a 'unload' event by clicking a button DO WORKS. :)
    But when I changed the triggered way by changing the <af:document> to clientComponent as what you did, the 'onbeforeunload' event won't come out when I refreshed or closed the page.
    That doesn't make sence, since I think the two ways to trigger a 'unload' event are the same.
    Edited by: 841766 on 2011-3-7 上午1:13

  • Firing a method of backing bean on Page Load

    Hi all,
    Can anyone tell me how a method of the backing bean can be fired when the corresponding jsf page loads in the browser...
    in fact some data is to be fetched from the server at the time of page load and rendered in one of the fields ... kindly help me in this regard ...
    thanks in advance,
    Neeraj Upreti

    You can use a constructor or initialization block of the bean for this or maybe even introduce lazy loading in the getters, all depending on the expensiveness of the actual logic.
    If you're using JSF 1.2, you can also use the beforePhase attribute of the <f:view> to specify a method which is to be fired on beforePhase of the view. You can also add @PostConstruct annotations to the methods which are to be fired on construction of the bean.

  • What is difference between Managed Bean and Backing Bean?

    What is difference between Managed Bean and Backing Bean? Please guide me how to create them and when to use them?
    Please post sample for both beans.

    Hi,
    managed beans and backing beans are quite the same in that the Java object is managed by the JavaServer Faces framework. Manage in this respect means instantiation. The difference is that backing beans contain component "binding" references, which managed beans usually don't. Do backing beans are page specific versions of managed beans.
    Managed beans are configured either in the faces-config.xml file, or using ADF Faces and ADFc, in the adfc-config.xml file
    Frank
    Edited by: Frank Nimphius on Jan 31, 2011 8:49 AM

  • Remove unwanted backing bean binding

    Hi All,
    My JSFX page has around 200 fields and I have to manipulate only a few fields in the backing bean. When I use this method to bind the UI components with the backing bean Design--> Page Properties ---> Component Binding ---> Auto Bind, all the page UI components get bound. This creates unnecssary binding and my backing bean java files becomes quite messy and runs into 5000 lines. Is it possible to remove the unwanted ones manually without causing any harm. What's the best practice by the way.
    Thanks
    Edited by: user5108636 on Mar 10, 2011 8:38 PM

    Hi,
    This creates unnecssary binding and my backing bean java files becomes quite messy and runs into 5000 lines
    This exactly is why the auto-generate option for backing beans is disabled by default in JDeveloper. There is no functionality in the IDE to remove unneeded bindings (how would the tool be able to tell what you need and what you don't need given that managed beans can be referenced from other managed beans and are referenced from EL in the component binding property).
    Best practices for working with backing beans is to not create them by default and instead use managed bean that you turn into backing beans (which is when they have a page component binding reference) only when needed. This way you stay in control
    Sorry, I have no better answer for this
    Frank

  • Session backing beans and multiple navigator windows sharing session

    Hi let's suppose i have a web and page1, page2 and page3 that should share the backingbean. Normal navigation goes from page 1 to page 2 to page 3.
    I do not want a backing bean per page because i need to share data between my pages. The immediate solution is to put this bean in session context and use it in each page. But this has severe drawbacks:
    - The backing bean is the same each time I access any page, and I want a new bb to be used each time the user requests for page 1
    - When a user has more than one navigator window sharing session, and on each window he is navigating through pages 1 to 3, there can be a big mess because he is accessing to the same bb from both windows.
    So I would like to find a solution that permit the user to navigate from both windows as if the windows had its own session.
    Any hint?
    Thnx

    I have a similar problem as described .
    I hava one window with enterable fields and when you click on a button it opens another window .Both forms are backed by the same bean .since both forms are nearly the same .
    The bean is a managed bean in request scope .
    when I fill in the first window with values and click on the link it opens the second but the first windows elements and now empty .
    Even though it is in Request scope when the second window is being loaded the bean is re-initialized . I would expect a new intance of this bean to be created for the second window .
    This is how I am calling the second window .
    <h:commandButton id="newRequestItem" action="#{requestItem.createNewRequestItem}" rendered="#{createActivationRequest.displayCreateLinks}" onclick="openNewPage('NewRequestItem.jsp');"
    image="images/show_all.gif" title="new request">
    <h:outputText value="new request" styleClass="toolbar-command"></h:outputText>
    </h:commandButton>
    function openNewPage(url)
         aqcbwin= window.open(url, "newRequestItem","toolbar=no, scrollbars=1");
    aqcbwin.moveTo(50, 50);
    target="_new";
    //target="_blank";
    aqcbwin.focus();
    any ideas to what is wrong and how I can correct this .
    Thanks for your help .
    Mark

  • Backing Bean Design Issue

    Hi,
    I am new to JSF, we recently decided to move from JSF, as part of a rewrite.I have struts background.
    I have skimmed many JSF books including Core JSF, JSF inAction and many online resources.
    But i still have not been able to get any recommendation/best practice ABOUT Best practice
    for desigining BACKING BEANS for a big enterprise project.
    Almost all resources detail 2 available methodologies i.e.
    1) Have backing bean per page, which doest seem OO way. And if i move
    input components between pages, i have to modify the backing bean.
    2) Or have backing bean per business functionality. For example in my domain, 1 backing bean
    for User General Info, 1 backing bean for Driver History, 1 Bean for Vehicle Information.
    I would appreciate if i could get some input from experts in the area, to give some pointers,
    As this question is bound to come up in every JSF implementations. Having some common guidelines
    would greatly help.
    Thanks a lot
    GP

    Here is a pattern that worked well so far for us:
    Have a backing bean per transaction. Meaning if a transaction consists of multiple pages, you will still have one.
    However this transaction bean is not responsible for assembling data used by each page. Its main role is workflow, validation, and collecting data selected by user as pages are traversed as well as managing the actual transaction.
    It is typically a very thin bean with a scope of session and persists until transaction is completed.
    Now each page may display a different set of data like employee list in a datatable,...etc
    Assembling the data required to be displayed in a datatable will the responsibility of another bean type referred to as data bean. Please note that data beans could be used by different transactions or even different pages across transactions.
    There is a very loose coupling between a trx bean and a data bean (they really are not aware of each others). They essentially play different roles. The page knows about both the data and trx beans. But the reverse is not true. If you happen to use data beans with a scope of session, you will also need some clean up mechanism in your framework when a transaction is completed.
    I am sure others may have come across different patterns.

  • Binding an object tag value / Creating HTML via a backing bean

    I have a task flow that sets some properties in my backbean. I've bound the "classid" of an <object> tag to one of these values. However, the first time i load the JSFF page, the object tag isnt created, but if i refresh the page, its loaded correctly.
    This would lead me to believe that the binding isn't being done before the JSFF is rendered, so the question is. Does anyone know how to fix this? and if not, i have thought about creating a backing bean that would add the <object> tag to the page with the bind value, but have no idea how i would go about this.
    Does anyone know of any good tutorials on adding HTML via a backing bean before the page is rendered?

    After further investigation and talking to a colleague, It seems it might not be binding related, since if I print out the bind in a text field, it displays correctly. I think the problem is because I am trying to inject an object tag (hosts a .NET control) into a fragment, but this is never picked up and rendered. Thus, when I do a full page refresh, the object tag is added and all goes well.
    If I attempt to bind/add a ADF Faces component this way, it works correctly.
    Do you know how to inject code for a fragment?, I am very stuck at the moment - don't have that much knowledge on ADF, so any links/help would be appreciated.
    My scenario is this:
    I am using a task flow that has 2 fragments.
    Fragment 1: set properties - has two input fields and a next button which are bound to a bean that saves the input fields
    Fragment 2: display object tag using step ones properties.

  • Retain newly created rows after page navigation.

    Hello,
    I have designed two pages. On First page I have to create multiple rows and to assign some values I need to open another page.
    The problem is once we create new rows on view object and if we redirect to any other page its view object is automatically executed and newly created rows will not be retained.!
    I have tested redirection using both methods with retain AM to True, but its not working.
    pageContext.forwardImmediately("page",
    null,
    OAWebBeanConstants.KEEP_MENU_CONTEXT,
    null, null, true,
    OAWebBeanConstants.ADD_BREAD_CRUMB_NO);
    pageContext.setForwardURL("page",
    null,
    OAWebBeanConstants.KEEP_MENU_CONTEXT,
    null, null, true,
    OAWebBeanConstants.ADD_BREAD_CRUMB_NO,
    OAWebBeanConstants.IGNORE_MESSAGES);
    Please suggest something....
    Thanks,
    Swati

    Hi Krithika, Thanks for replying...
    Krithika wrote:
    If you want to create new row in table and commit to the db, please find this sample:
    http://andrejusb.blogspot.com/2009/11/crud-operations-in-oracle-adf-11g-table.html
    This is done automatically when user clicks on commit button on ADF create form, rows gets commited in database.
    I just need to display these newly created rows on ADF table on the same page below commit button.
    Can you give more details about your usecase..?
    What happens when the same user comes back after closing the session? Do you want still show the blank page/table with out any previous data created by the same user..? If yes, what happens to the previously stored data..?
    Basically, give a brief note on what you are trying to achieve..?
    When user comes back to this page after closing this session, it will not show any rows in the ADF table.
    user will enter new values to create new rows and this time again on click of commit button the newly row created for this session should be shown.
    The previously created rows are already commited to database table
    Hope I am able to explain the requirement. Please let me know for any questions on requirement
    Regards,
    Tanveer

  • Faces: programmatically creating and populating iterator in a backing bean?

    Rather than relying on bindings in pageDefs, I'm attempting to create and populate a JUIterator binding in a backing bean. The goal is to allow the backing bean accessible to any web page as a session bean without having to hard code the iterator in every page's pageDef file.
    I haven't had any success on finding a demonstration showing how to do this programmatically and have come up with the following code as a hack:
    DCDataControl dataControl = bindingContainer.findDataControl("AppModuleDataControl");
    ApplicationModule appModule = dataControl.getApplicationModule();
    JUIteratorBinding iterator = new JUIteratorBinding(appModule, "SingleRowView1", "SingleRowView1Iterator");
    bindingContainer.addIteratorBinding(iterator);
    iterator.setRangeStart(0); // Exception raised here
    iterator.setRangeSize(1); // Or here
    iterator.executeQuery();  // Or here
    Row row = iterator.getCurrentRow();Note the SingleRowView1 is a VO exposed through my ADF BC AppModule and returns a single row and column.
    At the appropriate line marked "Exception raised here" an exception is thrown. On this line and the next 2 lines, it doesn't matter if I comment out one or the other, any 3 will raise an exception showing I've a problem with the iterator setup I guess?
    Anybody any hints on how we would construct the iterator dynamically? Do I have to create the individual attributes for the iterator? Have I not done something in correctly creating the iterator?
    Any help appreciated.
    Regards,
    CM.

    Chris,
    I don't have an answer for you but in JDeveloper 11 templating allows you to create a pagedef file that then is inherited by all pages. So chances are that what you build today is no longer needed tomorrow
    Frank

  • How to Create ADF table from backing Bean

    Currently I am working on Jdeveloper11g.
    I have a requirement to create Table dyanamically .For that i will get info about table from config file.
    <?xml version="1.0" encoding="UTF-8"?>
    <Pages>
              <page1>
              <Type sortable = "false">TYPE</Type>     
                   <Decription sortable ="true">Description</Decription>
                   <Date sortable = "true" >Date</Date>
                   <Amount sortable ="false">Amount</Amount>
              </page1>
              <page2>
                   <Type sortable = "false">Account Number</Type>     
                   <Decription sortable ="true">Account Name</Decription>
                   <Date sortable = "true" >Creation Date</Date>
                   <Amount sortable ="false">Current Balance</Amount>
              </page2>
    </pages>
    Can you guide me what classes i have to use in backing bean.any sort of code or usefull Links will be highly appriciated.
    Thanks
    Jaydeep

    Hi Jaydeep,
    you can create ADF table using this code,
    RichTable table = new RichTable();
    table.setEmptyText("no rows yet");
    table.setVar("row");
    // add columns
    RichColumn column = new RichColumn();
    column.setHeaderText("Name");
    column.setId("id_column1");
    column.setAlign("right");
    column.setWidth("100");
    // Set output.
    RichOutputText output = new RichOutputText();
    output.setValue("value", "John M.");
    // Add output into column.
    column.getChildren().add(output);
    // Add column into table.
    table.getChildren().add(column);
    Good Luck.

  • Change Backing bean create by Netbeans

    Hi,
    I create a page using NetBeans Visual JSF Page. But it create one backing associate, but I would want change this backing bean or change the default package.
    Is it possible?
    Thanks.

    IF your bean knows if a user has the right authentication you just have to change
    #{securityContext.authenticated ? "/ad...
    to
    #{yourBean.authenticated ? "/ad...
    in you Bean you need a method which returns true for 'User has authentication ' of false otherwise.
    Timo                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Problem in creating a row in backing bean for a view object..

    hi,
    i've created a view object and am trying to create multiple rows in my backing bean. but am not able to do that one. my 1st row is getting inserted and all the other values am not able to do. can anyone reply to this as soon as possible.
    Thanks in advance,

    Can you post your code?

  • Create a report in a popup (validation needed in back bean before popup)

    Hi all,
    I am very new to JDev and ADF, I am struggling to generate a report in a popup through the back bean, some validation is needed in the back bean before the popup. When creating the popup window, the url of the popup will be the URL of a servlet I searched the forum and found 2 approaches:
    http://thepeninsulasedge.com/frank_nimphius/2007/09/11/adf-faces-showing-reports/
    can af:showPopupBehavior work together with action- or launchListener? (approach by Julian Stephen)
    But I have a few questions for these approaches:
    for first approach:
    is “documentURL” in the commandButton_action() the url for the my report servlet,
    another thing is that, in this commandButton_action(), it said: return "dialog:open"; But I couldn’t find anywhere in the content that shows dialog, open are component ids? Or I am misunderstood it?
    for the second approach:
    where is the url for my report servlet put? Is it in the "hints" in the function “popup.show(hints)”?
    I can try the second approach first, but for the first approach I really want to know what is the "return dialogLopen" about?
    If there are any other means, please let me know!
    Your help is highly appreciated!
    Shawn

    My bad, in the first approach, "dialog:open" is the action string not component ids.

Maybe you are looking for