Setting Component rendered property On Page-Load

I am using Jdeveloper 11g - fusion- web application.
What I am trying to do is, onpageload, I am trying to over-ride some default properties of my uiComponents like rendered or read-only programatically.. I was referring to Steve Muench's Example no 60 -
[http://radio.weblogs.com/0118231/stories/2004/09/23/notYetDocumentedAdfSampleApplications.html] to do this. That is to say, I have a controller for my page-def file which implements the PagePhaseListener. It looks something like
{color:#ff0000}
public void beforePhase(PagePhaseEvent pagePhaseEvent) {
if (pagePhaseEvent.getPhaseId() == Lifecycle.PREPARE_MODEL_ID) {
if (!isPostback()) {
new AttributeAuthorization().initializeAuth();
}{color}
{color:#000000}
And inside the initializeAuth() method, I get a handle to the current instance of FacesContext, get the context.getViewRoot()
component tree, iterate on the component tree and call uiComponenet.setRendered(false/true)
for some components. My problem is, when the page is rendered, the values I have set is not reflecting. But on the next request, ie, if I simply press the commit button on my page, all the components are rendered the way I expect them to...
I tried doing this in different phases of the life-cycle like PREPARE_RENDER_ID, PREPARE_MODEL etc, in before and after methods, but my page renderes the way I expect it to only on the next request/page submission!!
{color}
Edited by: Julian Stephen on Dec 7, 2008 9:05 PM
Edited by: Julian Stephen on Dec 7, 2008 9:14 PM

The reason why I do-not want to use a managed bean is that, I want to do this for all the components in my page(It is reasonably big too). So doing this by a managed bean would mean, I need an interface which has as many getter methods as the no of components in the page. Also, we are still in developement which means everytime some-one adds a new component in the page they need to add a new getter method in the interface. Well not just the interface, but also in all the implementing classes...
The business use-case is that, I have one page in the application which has different levels of visibility(Some components read-only, some not rendered, some editable) based not just on who is logged in but also on other business conditions decided on the page prior to this. So based on these different conditions I build different schemes or themes(I have like 3/4 themes) which decides which components are read-only, which all are editable etc etc... Now I have to apply this 'theme' on to my page :). The way I am trying to do it now, everytime a new component is added, its visibility just need to be set in the property files of different themes.
Thanks,
Julian

Similar Messages

  • How to set the bind variable on page load and execute query ?

    Hi All,
    I am using Jdeveloper 11.1.1.5
    I have a table called "Employee"
    Columns :- id , name , location
    Data :- 1, ,james , chicago
    2 ,Raj ,capetown
    Now i have another webservice(created as a webservice dataControl) which sends me the "id" on each time my page loads.Now the id which has been returned by webservice should be incorporated in my VO Query as in where clause to fetch the data for the respective "id" in that "Employee" table and should be rendered on form.
    Eg :- Id "2" has been sent by the webservice then the record should be fetched from database should be "2","raj","capetown".
    I know that there would be necessity of bind variable , but how do i set the bind variable on page load ?
    How can i use the bind variable appropriately ??
    Please suggest !!!!
    Thanks.

    Hi,
    Check
    http://www.orastudy.com/oradoc/selfstu/fusion/web.1111/b31974/web_services.htm#CJADCDBG
    http://thepeninsulasedge.com/frank_nimphius/2011/02/18/adf-code-corner-sample-73-released-hands-on-creating-a-search-form-using-a-pojo-ws-and-the-web-service-data-control/
    -Suresh

  • Set VO bind variable on page loading programmatically

    Greetings everyone!
    I use JDeveloper version 11.1.2.3.0
    I am currently trying to get some filtered data from a VO, based on a WHERE clause with a bind variable. This process should be done on page load. I have to set this bind variable with the id of the logged user (the part of getting this id is already achieved and used somewhere else). My current approach is defining a managed bean with pageFlow scope. Inside this i have a method in which i retrieve the id and i set it as the parameter value. The code snippet:
          BindingContainer bindings = getBindings();
            OperationBinding operationBinding = bindings.getOperationBinding("getUserIdFromUsername"); //getUserIdFromUsername is a method defined in the AppModule and exposed in the client interface
           operationBinding.getParamsMap().put("username", getUserName());
          Object userID = operationBinding.execute();
            setUserId(Integer.parseInt(userID.toString()));
           System.out.println("THE USER ID IS: "+getUserId());
           BindingContainer bindings2 = getBindings();
           OperationBinding operationBinding2 = bindings.getOperationBinding("ExecuteWithParams");  // i've dragged and dropped the ExecuteWithParams operation into the page
           operationBinding2.getParamsMap().put("userId", getUserId());  // userId is the bind variable which i'm talking about
            Object result = operationBinding2.execute();
    Then, i call this method on BeforePhase in the page view. It works, i get the filtered data and the println shows me the correct ID. The problem is that each time i select a row in the table showing the data, the page seems to reload and it always get the selection back at the very first row.
    What am i doing wrong? May be this is not the right approach, as i've seen some other posts about this topic but they are not very clear to me.
    Please advice

    Approach1:
    Drag and Drop an Application  method as Default Method Call Activity, then draw a control flow case from the method to your page.
    In the application module method, implement appropriate logic.
    Approach2:
    Using a combination of client listener and server listener will also help.
    <af:clientListener method="onLoadAction" type="load"/>
    <af:serverListener type="MyCustomServerEvent"
    method="#{backingBeanScope.editBean.onLoadListener}"/>
    function onLoadAction(event){
               /*alert(':::: onSave ::');*/
               AdfCustomEvent.queue(actionEvent.getSource(),
                             "MyCustomServerEvent",
                             true);
           actionEvent.cancel() ;
           actionEvent.stopPropagation();

  • Rendered property and page data refresh!

    Hi I have a jspx page. There I have some fields. If in one field I choose value 1, then I can see 2 more fields, but if I choose value 2 then I can see 5 more fields. The first value is set to 1 an I can see 2 more fields, but if I choose to set value to 2, then I can,t see 5 more fields. It looks like refresh don't work ore something else. Can You say what to do?
    Best regards!

    HI, Pedja, the problem was that AutoSubmit need to be true on changing field. PLZ Can You see my post - Using ajax to show info? setPropertyListener
    Best regards!
    Edited by: Debuger on Mar 10, 2010 1:28 AM

  • How to set Rendering property of an item in a Default Double Column

    Hi ,
    I have developed a self service query region with default double column region. I have placed a combination of Input Text , LOV component in that region. My Issue is , I need to set the rendering property of the LOV input during run time. I used the OAMessageLOVInputbean.setRendered(false) in my contoller class. But I found that this is not working.
    Is there is any other way to handle the rendering property of item's in a default double column during run time.
    Thanks

    Here is the code snippet
    import oracle.cabo.style.CSSStyle;
    import oracle.apps.fnd.framework.webui.beans.message.OAMessageTextInputBean;
      public void processRequest(OAPageContext pageContext, OAWebBean webBean)
        super.processRequest(pageContext, webBean);
          CSSStyle css =new  CSSStyle();
                 css.setProperty("text-transform","uppercase");
                 OAMessageTextInputBean mtib=(OAMessageTextInputBean)webBean.findChildRecursive("HelloName");
                 if(mtib!=null) {
                 mtib.setInlineStyle(css);          
    }Hope it helps!!!
    Thanks
    AJ

  • Execute code on UI component during page load

    Hi All,
    I am usng Jdeveloper 11gR2.
    I want to invoke below code snippet to change the properties of input text fields and set them to enable on page load -
            FacesContext facesContext = FacesContext.getCurrentInstance();
            UIViewRoot root = facesContext.getViewRoot();
            RichPanelFormLayout formClass = (RichPanelFormLayout)root.findComponent("id");
            List<UIComponent> uiComponentList = formClass.getChildren();
                  for (UIComponent uiComponent : uiComponentList) {
                      if (uiComponent instanceof RichInputText) {
                          //((RichInputText)uiComponent).setDisabled(true);
                          ((RichInputText)uiComponent).setColumns(100);
                          Boolean flag = ((RichInputText)uiComponent).isChanged();
                          System.out.println("flag - " + flag);
    At present the code snippets works well on command component action but I want to execute the same during initial page load without the use of any command component.
    Please advise on how to achieve this.
    Best Regards,
    Ankit Gupta

    Check out https://blogs.oracle.com/adf/entry/an_epic_question_how_to
    Solution 2 (invoke actions) are deprecated in 12c so I wouldn't recommend using it.
    Timo

  • How to personalize and set rendered property false to poplist

    HI,
    could u please tell me that How to personalize and set rendered property false to poplist
    when poplist was developed initially it's user personalization property set as FALSE, that is why when i tried to personalize and set rendered property as flase, i could not able to find the property as rendered for that perticular item.
    Please provide me step by step process.
    Thanks,
    Ram.

    Hi Ram,
    you can do set rendered false through personalization as well as co extension.
    if you go for persoalization set the profile option Personalize Self Service Definitions and clik on personaliztion link
    then search for item and set its rendered property to false.
    If you go for co extension capture the poplist bean and and setRendered(false) to that field.
    If you are feeling difficulty by personalizatoin better go for CO extension.
    Thanks
    Amit Jaitly

  • Place default checkbox value "in SESSION" on initial page load

    Oracle 11.2
    Apex 4.1
    Desire outcome: Chart renders on inital page load using default value of checkbox in query.
    I have a checkbox with a default (checked) value. It shows checked when the page renders for the first time but the value is not in the SESSION state. I use this value in a query for a chart. I do not want to use a Submit button so I have a dynamic action submitting the value for the checkbox and the chart refreshes as desired when I check and uncheck the box.
    I tried "Fire on Page Load" in the DA Execution Options, as well, but that caused a loop where the page renders and immmediately renders, and immediately renders, etc.
    Is there a declarative solution that submits the current, in this case default, values when the page is loaded? I only need and want the default values used the first time the page is accessed. This is the initial page of the application but I need the same behavior on all pages for the separate checkbox selections found there.
    May God Bless,
    Howard

    Howard (DBA in Training) wrote:
    If I remove the Default Value and add a Before Header page computation for the item with static assignment to
    a:bI get the 2 A/B checkboxes, both checked, and the value is set in session state.If you log in here, you can see it up close and personal!
    http://apex.oracle.com/pls/apex/f?p=21997:3 Login: Dever / Ima9Dever
    The Default Value colon-delimited string must contain the checkbox values, not the labels. In a static LOV the checkbox options are specified as <tt>label;value</tt> pairs. Thus in your checkbox LOV the labels are A/B, whilst the values are a/b. The values are case-sensitive.
    The Default Value should therefore be:
    a:bwhereas you've specified:
    A:BWith the checkbox item LOV Display Extra Values property set to Yes, APEX displays these extra values that are not included in the LOV definition as additional checkboxes. You can see this if you inspect the rendered checkbox elements in the HTML source:
    <input type="checkbox" id="P3_CHECKBOX_0" name="p_v01" value="a">
    <input type="checkbox" id="P3_CHECKBOX_1" name="p_v01" value="b">
    <input type="checkbox" id="P3_CHECKBOX_2" name="p_v01" value="A" checked="checked">
    <input type="checkbox" id="P3_CHECKBOX_3" name="p_v01" value="B" checked="checked">You get the a/b values defined in the LOV, plus the extra A/B values the LOV knows nothing about.
    ==== ) How do you keep it from setting/resetting these values each time the
    page is rendered?  The need is to do it only the very first time?  ( ====Put a Value of Item / Column in Expression 1 Is NULL condition on the Computation. Problem then is that the computation will be run if the user can [legitimately] deselect all of the checkboxes, either leaving you back where you started, or requiring the use of a further item to flag whether it is the really "the very first time" (which I find intellectually deeply unsatisfactory). This may be a sign that the control should really be a radio group that always has one option set, rather than a check box.

  • How to eliminate empty node space from tree when rendered property is false

    Hi
    I have created a menu Tree for my ADF BC application while working in JDev 10.1.3.3.
    I have tried two methods, first is by creating a menu model as discussed in example in ADF Developers Guide Book Section 19.2.1. Second by creating two view objects and creating the menu tree from my database table.
    Depending on the logged in user I want to decide whether to show or not to show a menu tree option to the user. For this purpose I have implemented a function in a managed bean that calls a pl/sql stored procedure to decide if the user has access to a certain component. In first case I have set the rendered property of the menu item to #{menuTree.shown}, where shown is an attribute in the menu model whose value is properly set using java functions that call pl/sql function in turn. In second method, I have also tried to set the rendered property and calling a function that returns true or false based on if the user has access to the menu option.
    Problem
    When rendered property is returned as false, although the menu option is not displayed but an empty space is displayed in my tree and remaining nodes and/or menu options are displayed with an ugly gap.
    How I can remove this unwanted gap, is there a way?
    Regards,
    Amir
    1st option:
    My menu tree:
    <af:menuTree var="menuTree" value="#{menuModel.model}">
    <f:facet name="nodeStamp">
    <af:commandMenuItem text="#{menuTree.label}"
    action="#{menuTree.getOutcome}"
    _rendered="#{menuTree.shown}_"/>
    </f:facet>
    </af:menuTree>
    2nd option:
    <af:tree value="#{bindings.MainMenuView.treeModel}" var="node">
    <f:facet name="nodeStamp">
    <af:switcher facetName="#{node.hierType.name}">
    <f:facet name="MainMenuViewNode">
    <af:outputText value="#{node.Name}" _rendered="#{userInfo.mainNodeOk}"_ />
    </f:facet>
    <f:facet name="SubMenuViewNode">
    <af:commandLink text="#{node.Name}" _rendered="#{userInfo.mainNodeOk}_">
    <af:setActionListener from="#{node.destinationUrl}"
    to="#{menuTree.getOutcome}"/>
    </af:commandLink>
    </f:facet>
    </af:switcher>
    Edited by: Amir Khan on Jan 12, 2009 8:54 PM

    Hi,
    if this reproduces in JDeveloper 10.1.3.4 then this sounds like a bug that you should file
    Frank

  • Rendered property equal result of method call ? Can it be done

    Hi Guys
    Is it possible to set the rendered property to the result of a method call.
    So for example I have an Input Text Item and I want to turn it on or off depending on whether the value of the date selected is a saturday.
    I was hoping to add a method to the backing bean called boolean isSaturday() and use the result of that on the Rendered property.
    Does anyone know if this is possible and provide an example of the EL syntax required to perform this function.
    Thanks in advance
    Kris

    Hi Kris,
    off course this is possible using Expression Language. Mention following condition in the rendered attribute of a (Faces) UI component and the method (getter) in the backing bean:
    rendered="#{userInfo.admin}" UserInfo class:
        private boolean admin = false;
        public void setAdmin(boolean admin) {
         this.admin = admin;
        public boolean isAdmin() {
         return admin;
        }The component will render depending on the value of the admin variable.
    Regards,
    Koen Verhulst

  • Dependent field not available on page load

    I have a form on my website to that uses java script to map dependent values. If I set the first value on page load, the values in the second field aren't available. If I cycle the first field, the scripting runs and the dependent options are available.
    The dropdowns work when the first is pre-selected in IE and Safari, this is causing problems for our Firefox users.

    Try posting at the Web Development / Standards Evangelism forum at MozillaZine. The helpers over there are more knowledgeable about web page development issues with Firefox. <br />
    http://forums.mozillazine.org/viewforum.php?f=25 <br />
    You'll need to register and login to be able to post in that forum.

  • How i can check whether a component is being placed or it's being rendered during page load...

    Hi,
    I have a piece of code which needs to be triggered only when the component gets rendered.. and at the same time it shouldn't get trigerred when author places it in the page...
    For an example, Consider i have a component called samplecomponent. Also i have a piece of code in samplecomponent.jsp which should get triggered only when the component is being rendered during page load and if author places that component in the page (ofcourse the samplecomponent.jsp will get triggered but my particular piece of code should not get triggered.. Is there any condition to check that..?
    Thanks
    Shankar .A

    Hello Shankar,
    I think this is very straight forward and you can set this condition based on any of the property of your component via check null/empty condition because when you will drop your component the properties of your component will be not initialized and you can check for at (let say you have a property which is mandetory so to instantiate that component you have to have at least that property)
    And let say if above option doesn't work for you then there is one more option of checking the edit mode of the page and based on that you can differ your code. But edit mode code will not work until you will see the page in edit mode, the code will only work when you switch to preview mode (publish mode) of page from edit mode (from sidekick at bottom you have option to go to edit and preview mode).
    WCMMode mode = WCMMode.fromRequest(request);
        if (!mode.equals(WCMMode.EDIT) && !mode.equals(WCMMode.DESIGN)) {
         //this part of code never execute when your page is in edit mode (dropped content or load the page in edit mode). but this part of code will run when you switch from edit mode to previe mode (in author node) or on  publish instance of Server because there will be no edit mode there.
    Let me know if you need more information or it doesn't help you.
    Thanks,
    Pawan

  • How to set Lov item property (Action type,event,parameter etc) in PR when page load

    Hi gurus
    I am new to OAF, First I need to explain my scenerio.
    I need to make some field mandatory or non mandatory based on one LOV item (Pick list or message choice list).
    for this i extended the controler and apply the changes, but in this case what heppen, It will effect only when i open the list (pop list) and click on more (Available in poplist) and it will open a new form and i select value from that form. But when I open the poplist and select the value from the same list rather going to more option (it does not open new form), then there are no effect. I though the issue with refreshing when selecting value from the same list.
    To resolving this issue what i did
    1. go to page == > the same LOV
    2. Change the Client Action properties (
         Action type  = fireAction
         event          = xxevent
        submit = true.
    After doing this when i run the page from my OAF enviroement , every thing is OK. Then I transfer the Controler to Server machine and change the controller and run the same page from the server, it has the same refreshing issue, Then I thought because I did not transfer LOV such properties so this is hepening,
    Now I want to initilize such properties in Page load or what I need to do, Please advise me.
    Regards,
    Haq

    Edward,
    Thank you for the suggestion! It directly lead to my solution wherein I used CASE statements for the column in my Region SELECT such as the following:
    WHEN (:P2_GRADING_METHOD = 'CR/NC' OR scs.scs_pass_audit = 'P') AND GET_GRADE_B93 (sac.stc_final_grade, sac.stc_verified_grade) IS NULL THEN htmldb_item.select_list_from_lov (5, 'Enter Grade', 'GRADE_LOV_CRNC','onBlur="return validate_grade(this,''FW_DATE_'||ROWNUM||''')"','NO',NULL,NULL,'GRADE_'||ROWNUM)
    When the column is NULL, the Select List (LOV) contains the entry 'Enter Grade' and that is the value displayed on page load. I bypass the value 'Enter Grade' during Submit Processing where database updating occurs.
    I did not find the need to enter values for p_null_value and p_null_text since I don't believe that it would cause the 'Enter Grade' value to display on page load for null value columns but rather would enable the user to select 'Enter Grade' from the list and have a specified return value stored in htmldb_item array.
    Again, thank you for the help!

  • How to initialize an adf component before a page loads

    Hi all
    I use JDeveloper 11.1.2.2.0
    I have two pages:
    first page has a link to a second page
    <af:document title="first.jspx" id="d1">
      <af:form id="f1">
        <af:commandLink text="Page 2" id="cl1" action="goToSecondPage" actionListener="#{Bean.handleLinkActionEvent}"/>
      </af:form>
    </af:document>and the second page has an inputText component:
    <af:document title="second.jspx" id="d1">
      <af:form id="f1">
        <af:inputText label="Text" id="it1" binding="#{Bean.inputText}" readOnly="true"/>
      </af:form>
    </af:document>First I load first.jspx and than I click the link. This event is handled in handleLinkActionEvent() method, in which I want to set a value to the inputText component of the second page. But I can't do it, because as expected I get NullPointerException.
    So the question is how to initialize an adf component before a page loads?
    Evgeny Michuk
    Edited by: Evgeny Michuk on Oct 4, 2012 11:30 PM

    Thanks a lot for your replies and links, it gives me some new knowledges.
    I got your approach and achieved the aim for the described situation with tag <f:setPropertyActionListener>:
    <af:commandLink text="Page 2" id="cl1" action="goToSecondPage"
                           actionListener="#{Bean.handleLinkActionEvent}" binding="#{Bean.firstPageLink}">
      <f:setPropertyActionListener target="#{pageFlowScope.text}" value="Hello, World!"/>
    </af:commandLink>and for the inputText component I set the value:
    <af:inputText label="Text" id="it1"  binding="#{Bean.inputText}"
                                  readOnly="true" value="#{pageFlowScope.text}"/>I used request scoped managed bean and it is shared for both pages.
    I understand that I can set a value of some attribute for managed bean
    and use it to set a value for inputText component of the second page,
    but as I understand it is almost the same way as usage of tag <f:setPropertyActionListener>.
    In my real situation on the second page I have a dynamic table, and it's field is read only.
    Structure of this table depends on a link clicked on the first page.
    So I define components for table columns in runtime, it may be outputText, inputDate, goLink and some others.
    And I have to get table through the UIComponent binding to set columns.
    Certainly I can define all needed components for all columns
    and render it according to the column types
    <af:table value="#{Bean.collectionModel}" var="row" id="t1" binding="#{Bean.mainTable}">
       <af:forEach items="#{Bean.columnDescriptionList}" var="column">
          <af:column headerText="#{column.caption}" id="c1">
             <af:outputText value="#{row[column.fieldName]}" id="ot1" rendered="#{column.type == '1'}"/>
             <af:inputDate value="#{row[column.fieldName]}" id="ot2" rendered="#{column.type == '2'}"/>
             <af:selectBooleanCheckbox id="sbc1" selected="#{row[column.fieldName] == '1'}" rendered="#{column.type == 'n'}"/>
          </af:column>
       </af:forEach>
    </af:table>but I think it is not very good.
    Have you any idea?
    P.S. I hope I clearly explained my situation =)
    Evgeny Michuk

  • Trouble setting component property

    I'm a Flash newbie trying to build a custom component using
    Flash MX 2004. basically it's an enhanced version of the standard
    label component. Everything seems to work fine except when trying
    to set default text or assigning a text value in the "properties"
    window (the field displays in the properties window, but any value
    typed into it does not appear during movie playback). Currently,
    the text can be seen only in authoring mode, not when the movie
    plays. The only way for the text to displayed during playback is to
    set it up through code. Does anybody know what I'm doing wrong? .as
    file content follows.
    class CustomComponents.FormFields.lblFieldLabel extends
    MovieClip {
    private var objFieldLabel:MovieClip;
    private var strText:String = "";
    function lblFieldLabel() {
    init();
    public function init():Void {
    public function get displaytext():String {
    return strText;
    [Inspectable(defaultValue="display text", type="String")]
    public function set displaytext(val:String):Void {
    strText = val;
    objFieldLabel.text = strText + ":";
    }

    The reason why I do-not want to use a managed bean is that, I want to do this for all the components in my page(It is reasonably big too). So doing this by a managed bean would mean, I need an interface which has as many getter methods as the no of components in the page. Also, we are still in developement which means everytime some-one adds a new component in the page they need to add a new getter method in the interface. Well not just the interface, but also in all the implementing classes...
    The business use-case is that, I have one page in the application which has different levels of visibility(Some components read-only, some not rendered, some editable) based not just on who is logged in but also on other business conditions decided on the page prior to this. So based on these different conditions I build different schemes or themes(I have like 3/4 themes) which decides which components are read-only, which all are editable etc etc... Now I have to apply this 'theme' on to my page :). The way I am trying to do it now, everytime a new component is added, its visibility just need to be set in the property files of different themes.
    Thanks,
    Julian

Maybe you are looking for

  • Fax not detected,C​omm error, fax run test is all PASS,

    Hi Good Day! Im Using a HP color Laserjet Pro MFP M177fw. The Problem is sending fax messages. I do all the updates you need to installed. but the problem with my hp fax machine is still there specially i still receive a fax not detected issue,comm.e

  • Good saxophone, mouth organ, brass and banjo sounds

    Does anyone know where i can get good saxophone, mouth organ, brass and banjo sounds? Mainstage has them (except mouth organ), but I've heard better sounds on Roland machines. Any help would be appreciated. Thanks.

  • Macbook Pro behaving extremely strangely

    Today I took delivery of a new 11 inch Macbook Air. Started migrating over wi-fi from my 2009 Macbook Pro and obviously it was taking forever so I stopped it after a few hours. Now doing a backup restore to the Macbook Air from Time Capsule which see

  • Placing a Fish or Deer on top of original background photo

    I have a photo of the evening sunset and I want to place a Fish pic on left side and a deer pic on the right. How do I do this with photoshop or another method? Any help will be greatly appreciated. Thank you,               Marvin Engel           www

  • Confusing to define the meaning of using DI

    Dear Experts/Gurus, I have a problem to define the meaning of take partial payment via DI and Create an A/R Invoice or Credit Memo using DI API. Does it means via DTW and using DTW ? I also find out there are the scripts/code used : Dim oSO As SAPbob