How to assign a value to a control to display after loading the page?

I use JDeveloper 10.1.3.3 using ADF.

How can I run a support bean method to populate a control immediately after loading the page. My intention is to populate a control hidden with the session id. The code that I would run is something like this:

FacesContext ctx = FacesContext.getCurrentInstance ();
ExternalContext ectx = ctx.getExternalContext ();
HttpSession mySession = ectx.getSession (false) (HttpSession);
String sessionId = mySession.getId ();

Where would I put this code?

Thank you

John

Published by: John Matozzi, October 28, 2008 15:47

Hi John,.

create a method called getSessionId returning a string in your bean support.

    public String getSessionId(){

        FacesContext ctx = FacesContext.getCurrentInstance();
        ExternalContext ectx = ctx.getExternalContext();
        HttpSession session = (HttpSession) ectx.getSession(false);
        return session.getId(); 

    }

then in your page you can use the link editor to call the method and display its value.


Brenden

Tags: Java

Similar Questions

  • "Hide / show" regions – how to keep open after send the page

    Hello

    I have several regions ' hide / show ' in my request... when the user submits the page, it closes all the

    is there a way to keep one open that were opened before the page is sent?

    Thanks in advance

    Long answer: forget the hidden item and simply store the values in a cookie.  Use dynamic action, 1 2 plan to store the values when the page is submitted and the 2nd DA to retrieve the value and developing regions.

    Hide and Show parts APEX sticky

    Dynamic action 1

    Name: Save the open areas

    Event: before the Page is sent

    Condition: - no requirement.

    Real Action:

    Action: Run the JavaScript Code

    Fire on Page load: [disabled]

    Code:

    var lOpenRegions = []
    $(".hide:visible").parent(".hide-show-region").each(function()
      { lOpenRegions.push($(this).attr("id")) });
    SetCookie("HideShowOpenRegions",lOpenRegions.join(","));
    

    Dynamic action 2

    Nom : Open saved regions

    Event: Loading the page

    Condition: - unconditionally.

    Real Action:

    Action: Run the JavaScript Code

    Fire on Page load: [disabled]

    Code:

    if (GetCookie("HideShowOpenRegions")) {
      $.each( GetCookie("HideShowOpenRegions").split(','),
                function(intIndex, objValue) {
                  $("#"+$nvl(objValue,"x")+" .hide:first").show();
                }
      );
    }
    
  • How to assign a value to the attribute support bean viewcriteria?

    Hello

    I have a readonly VO with the following query

    Select value attr2, attr1, attr4, attr3
    from sometable

    I have a criterion for display in the t above, something like
    attr1 =
    and attr2 =

    I dragged and dropped this criterion on a Status.jsff page in the Panel of the query with table. If the user can search the records by manually entering the values in the query Panel. In addition, there are another page Main.jsff where, if the user clicks on a button, it redirects him to the page Status.jsff carrying a digital value from the page Main.jsff. Now, I have to assign this numerical value of "attr1" criteria to display and execute this VO and show results updated in the Status.jsff page.

    I used the code below:
    ViewObject vo = appModule.findViewObject("VOName");
    ViewCriteria criteria = vo.getViewCriteriaManager () .getViewCriteria ("CriteriaName");
    criteria.getVariableManager () .setVariableValue ('attr1', numericValue);
    vo.applyViewCriteria (criteria);
    vo.executeQuery ();
    For the above code, I got an error saying that "attr1" Variable not defined in the 'VOName '.

    Then I tried to place where simple clause of
    vo.setWhereClause ("attr1 =" + numericValue);
    vo.executeQuery ();
    For this code, I got an error saying that the SQL error in the preparation of the statement. Statement: SELECT * FROM (select attr1, attr2, attr3, attr4, of VOName) QRSLT WHERE (attr1 = 1234)

    Please let me know the solution to this problem.

    You can set the variable bind display property to hide. If variable binding will not appear in the query.

    bindvariable control flag > show hint > hide.

    TUTTU JOSE

    Published by: josetuttu on November 13, 2011 21:45

  • How to assign a value of the element from page to main page in the column element when Cre

    I have a form build on table T1. The T1 has a primary key defined (T1PK) and four other columns (C1 - C4). I have a form in this table. This form accepts the values of C1 to C4 and displayis an extra point, is not based on columns of T1 - P1_DUMMY. The form for T1PK element has the value "hidden and protected.
    When creating the form, I wanted that the value of the primary key (T1PK) will be obtained through existing trigger. I want to use the value stored in the page called "P1_DUMMY" for P1_T1PK.

    No matter what I do, I always get this error when I hit the button 'CREATE' on the page of the form:

    ORA-01400: cannot insert NULL into ('DEV'. "" T1 ". ("' T1PK")

    The Create button is a condition not to show if the the P1_T1PK page element is NULL. I created page rendering process, the process of transformation of page like this bock of PL/SQL:

    : P1_T1PK: =: P1_DUMMY

    But I still get ORA-01400. The form has the P1_DUMMY as display only, not not to store the State, so I can see that the P1_DUMMY element has the value I want (2).

    How to assign the value stored in P1_DUMMY in P1_T1PK when I click on the button CREATE on this form?

    Thank you for your time.

    Daniel

    Hello
    The belief question is the way in which the calculation is being defined. You are not using the &. rating (dot ampersand) in PL/SQL and SQL.

    Try this.

    1 define the calculation on P1_T1PK of Type calculation of value of the element
    2. on the next page to load textarea, enter P1_DUMMY. No. colon or &
    3. give appropriate conditions

    Kind regards

  • Set a value for an inputComboboxListOfValues before loading the page.

    Hello

    JDeveloper Version 11.1.2.4.0

    I want to put the PersonName (PersonId) value of the inputComboboxListOfValues as well as the value - PersonName display of the inputComboboxListOfValues before the page loads.

    I have PersonId and I can get the PersonName him. But do not know how to set the value until the page is loaded. If I put two PersonId, PersonName the displayed value is always set to null.

    The way I put the values is on the currentRow of the main object of the view.

                        <af:inputComboboxListOfValues id="personNameId" value="#{bindings.PersonName.inputValue}"
                                                      model="#{bindings.PersonName.listOfValuesModel}"
                                                      rendered="#{pageFlowScope.reportParams['personId'] != null}"
                                                      contentStyle="width:138px" partialTriggers="pcid" editMode="select"
                                                      columns="#{bindings.PersonName.hints.displayWidth}" autoSubmit="true">
                            <f:validator binding="#{bindings.PersonName.validator}"/>
                        </af:inputComboboxListOfValues>
    

    Untitled.png

    1. Get the current row of the object of the main view.
    2. Setting the 'PersonName' attribute that is bound to the inputComboBoxListOfValues and so is used for the display value.
    3. Definition of the attribute 'PersonId' to which the value is bound.

    Looks like that everything is settled in this way.

  • How messageTextInput element readonly on loading the page dynamically?

    Hi all
    This is my requirement. I have a point message text entry populated on load of the page attributeX of the VO. I need to check the condition of attributeY! = pageContext.getUserName () and if he is convinced that I have to make the item messageTextInput as read only when the page is loaded. To do this, I wrote the following code in the form request process.


    vo.executeQuery ();
    If (VO. GetCurrentRow.GetAttribute ("attributeY")! = pageContext.getUserName ())
    {
    OAMessageTextInputBean bean = (OAMessageTextInputBean) webBean.findChildRecursive ("txtItem");
    bean.setReadOnly (Boolean.FALSE);
    }

    Copy the following code throws exceptions. Also if I don't give the if condition and just trying to make the point to read only the loading of the page, it does not take exception, but does not in read-only mode.


    Please let me know how to solve this problem.

    Thank you
    Sunny

    Sunny,

    Can you check after the vo run the query, your VO have rows by
    vo.getFetchedRowCount (),

    And then do vo.first () and then only the if condition,

    Inside the if condition add some diagnostic message to check, your state of health is coming inside.
    print the values for vo.getCurrentRow.getAttribute ("attributeY"), pageContext.getUserName)

    And if you compare the string, you must use api .equals
    If (!) (vo.getCurrentRow.getAttribute("attributeY").equals (pageContext.getUserName ())))

    Thank you.

    With respect,
    Kali.
    OSSI.

  • Control action CommandButton execution while the Page Refresh

    Hello


    I'm developing an Application in the ADF. I have a method in Backing Bean. I associate this action property of the CommandButton control method in jspx Page.

    < af:commandButton text = "Submit".
    action = "#{backing_blockingRowWhileLoading.doNotExecuteOnPageRefresh} '"
    Binding = "#{backing_blockingRowWhileLoading.commandButton1} '"
    ID = "commandButton1" / >

    This is the code in the bean support

    public String doNotExecuteOnPageRefresh()
    {
    System.out.println ("loop of publication (postback)");
    Returns a null value.
    }

    When I'm clicking the button, the method is running of command and statement is being printed on the console. It is very good.

    The problem is when I am pressing F5 or refresh the browser method is executed once more.

    Can I write the method in bean support so that it is executed only when the button is clicked. It doesn't have to be executed when the page is refreshed with the button F5 or Refresh the browser.

    I tried with the statement below. He also failed.
    If (!.) {AdfFacesContext.getCurrentInstance () .isPostback ())}

    Can someone help me please to solve this problem. It is very urgent for me. Thanks in advance.

    Thank you
    Ravi kumar.

    Hello

    What is expected due to the postbacks, add a redirect tag in the navigation rule in faces - config.xml for the given navigation case.
    If you use workflows, set redirect to true on the view property.

    Jean Lou

  • Value of the URL parameter with: do not display correctly on the page

    Hello

    I'm working on a page with an interactive report. One report column is a hyperlink to another page (Page deletion). This link goes to an id and a title page delete such as its poster a confirmation message to the end user before to actually delete it. If the title contains a ': ' the text after the ":" is not displayed on the page (visible in the URL on top)

    Is it because that the ': ' separates parameters in a URL to the APEX and, therefore, the text after the ': ' is considered to be the following URL parameter?
    How can we solve this problem?

    Kind regards
    Priya Jetley

    A solution should be not only not to work with the parameters in the URL.

    Simply a process to pass values from one page to another as is:

    BEGIN
    IF: REQUEST = 'TEST' THEN
    P2_ID: = P1_ID;
    P2_TITLE: = P1_TITLE;
    END IF;
    END;

    In this case, your problem is solved, and it is safer because the user does not see what id is passed and can not manually put the id in the URL...

  • How can I get my properties box and back on down ot the page links? He disappeared.

    Somehow I deleted the property box at the bottom of the page, where I can add links and set several properties. How can I get it back?

    Switch to the Design mode.

    Window > properties (Ctrl + F3).

    Nancy O.

  • How to display data when the page loads

    I use JDeveloper/Oracle ADF 11.1.2.3.0.

    I have a jsf with a table page that was built by a named query. I chose the research with the table option when you drag the query named on the page.

    The named query uses a connection variable which is not set with the loading of the page. Therefore, no data is display even if the query is executed.

    But, I can then click on the button Search and display of the data.

    I tried to set the default value of the variable binding '%' in the OV, but that did not work.

    So, is it possible that I can get all the data displayed when the page is loaded. Perhaps by the calling program the by clicking the search button?

    Thanks for your help.

    Open the criteria to view that you defined in the t for your group, "indication of interface user" tab and check the box 'automatically interrogate. "

    Timo

  • How to add ads of Type Lightbox when loading the Page

    Hello world

    We would like to place a box of type lightbox which will dispay on our homepage as soon as the first load of the page. The Lightbox area, we would like to have a simple contact form. I was able to create a viewer with the content we want but cannot find how to open the box when the page is loaded.

    I also tried to use a pre-made contact form and adding the javascript code in the head of the page to load it but it doesn't close alow us to customize enough.

    Anyone have any suggestions on the best way to do it?

    Thank you

    By the link and article, I meant (hyperlink) links on the page.

    It would not take customization on your side, as you have to hide the page elements as they were returning to the page navigation.

    Check this out for customization:

    http://StackOverflow.com/questions/17203427/jQuery-how-to-remember-show-hide-elements-when-navigation-retour-de-UN other-pa

    Thank you

    Sanjit

  • Is it possible to access control with data binding to the page

    Hello

    I want to know if we can access the datacontrol operations in the bean with managed to link these operations to the definition of the page.

    For example: I have a method in the application Module that is under the control of data and create an impression of the page with link of this operation to the definition of the page.
    I created a button on the page and when you click on the button it calls a method in the managed bean.
    Can I run the operation in the data from the managed bean code control? Can I handle for the data from the managed bean code control?

    Please let me know if this can be done or not.

    Thank you
    Stephanie

    Why you don't want to use binding for this? Is there a specific reason for it, or you want to just make life harder?
    You could write a managed bean that has a method that creates and instance of AOS and calls the method - and then just call managed method from your page bean.
    Something like this:
    http://download.Oracle.com/docs/CD/E17904_01/Web.1111/b31974/bcservices.htm#CHDIBHBD

  • How to assign a value to a button

    I'm trying to assign an integer value to a button and the button must send the value of the integer assigned to the writing of TCP/IP, only when the button is pressed. I am able to send data using chain control (as indicated in the attachment) but I want to replace it with several buttons. for example, if I enter 2 in the control of the chain, these data will be sent to a robot (robot a Wi - Fi card) via the tcp/ip Protocol, it moves in front. 3 will return, 8 is on the left, 6 is just. These digital data are already burned in blackfin processor of the robot. In numbers in labview can make my robot so just move in the specified direction. can you please help me to create a button with value and convert it to a string and send it to the writing of tcp/ip. This only happens when the button is pressed. because, if I enter numbers in the control of the chain, it dosent seem good... If I have pimples... I think that my VI will look good and hitech.i am using labview 8.6robot reference:http://www.surveyor.com/SRV_info.html                          http://www.surveyor.com/                          http://www.surveyor.com/cgi-bin/robot_journal.cgi

    Hi momo,.

    You can use a structure of the event. Create a case for each button and enter the correct number to send. If you press a button of your, you can send data to your robot.

    Mike

  • How to assign a value zero if the value is null.

    I have a package, procedure and many functions. I'm trying to get the result of DBMS to list a value for each, if it is null, assign it a zero and move.
    I can't find examples where I can do. Any ideas on how I can assign a zero when there is no value in the table?
    CREATE OR REPLACE PACKAGE emp_net_pay IS
      PROCEDURE emp_tot_sal  (v_empno IN NUMBER);
      FUNCTION find_emp      (v_empno IN NUMBER) RETURN BOOLEAN;
      FUNCTION tot_sal_com   (v_empno IN NUMBER) RETURN NUMBER;
      FUNCTION bef_tax_ded   (emp_no IN NUMBER)  RETURN NUMBER;
      FUNCTION temp_sal_btd  (emp_no IN NUMBER)  RETURN NUMBER;
      FUNCTION tax_emp_sal   (emp_no IN NUMBER)  RETURN NUMBER;
      FUNCTION sal_aft_tax   (emp_no IN NUMBER)  RETURN NUMBER;
      FUNCTION aft_tax_ded   (emp_no IN NUMBER)  RETURN NUMBER;
      FUNCTION tot_net_sal   (emp_no IN NUMBER)  RETURN NUMBER;
    END emp_net_pay;
    /
    CREATE OR REPLACE PACKAGE BODY emp_net_pay IS
    --Procedure calculates totals: Salary plus commission
    PROCEDURE emp_tot_sal (v_empno IN NUMBER)
    IS
      v_tot_sal  NUMBER;
      v_bef_ded  NUMBER;
      v_temp_sal NUMBER;
      v_tot_tax  NUMBER;
      v_sal_tax  NUMBER;
      v_aft_ded  NUMBER;
      v_net_sal  NUMBER;
     BEGIN
      v_tot_sal  := tot_sal_com (v_empno);
      v_bef_ded  := bef_tax_ded (v_empno);
      v_temp_sal := temp_sal_btd(v_empno);
      v_tot_tax  := tax_emp_sal (v_empno);
      v_sal_tax  := sal_aft_tax (v_empno);
      v_aft_ded  := aft_tax_ded (v_empno);
      v_net_sal  := tot_net_sal (v_empno);
         DBMS_OUTPUT. PUT_LINE ('Salary before deductions for employee # ' || v_empno || ' equal: ' || to_char(v_tot_sal,'$999,999.99'));
         DBMS_OUTPUT. PUT_LINE ('Before tax deductions for    employee # ' || v_empno || ' equal: ' || to_char(v_bef_ded,'$999,999.99'));
         DBMS_OUTPUT. PUT_LINE ('Salary minus deductions for  employee # ' || v_empno || ' equal: ' || to_char(v_temp_sal,'$999,999.99'));
         DBMS_OUTPUT. PUT_LINE ('Total taxes for              employee # ' || v_empno || ' equal: ' || to_char
    (v_tot_tax,'$999,999.99'));
         DBMS_OUTPUT. PUT_LINE ('Salary minus taxes for       employee # ' || v_empno || ' equal: ' || to_char
    (v_sal_tax,'$999,999.99'));
         DBMS_OUTPUT. PUT_LINE ('After tax deductions for     employee # ' || v_empno || ' equal: ' || to_char(v_aft_ded,'$999,999.99'));
         DBMS_OUTPUT. PUT_LINE ('Net salary for               employee # ' || v_empno || ' equal: ' || to_char
    (v_net_sal,'$999,999.99'));
     END emp_tot_sal; 
    ..................................................
    Salary before deductions for employee # 7369 equal:      $900.00
    Before tax deductions for    employee # 7369 equal:       $95.34
    Salary minus deductions for  employee # 7369 equal:      $804.66
    Total taxes for                   employee # 7369 equal:       $56.33
    Salary minus taxes for          employee # 7369 equal:      $748.33
    After tax deductions for       employee # 7369 equal:        $8.00
    Net salary for                      employee # 7369 equal:      $740.33
    *******************************************************
    
    alary before deductions for employee # 7654 equal:    $2,650.00
    efore tax deductions for    employee # 7654 equal:
    alary minus deductions for  employee # 7654 equal:
    otal taxes for                    employee # 7654 equal:
    alary minus taxes for          employee # 7654 equal:
    fter tax deductions for       employee # 7654 equal:
    et salary for                      employee # 7654 equal:                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            

    NVL looking for [url http://docs.oracle.com/cd/B28359_01/olap.111/b28126/dml_functions_2048.htm]?

  • How to assign an access via Maxl control?

    Everyone has understood how to programmatically assign access control?

    Version 11.1.2

    We want to copy a database from one application to another application but it erases the part of the security on the application 'To '.

    You use LCM in Shared Services to migrate security.

    You can use a LCM command line utility to automate the task in a .bat process.

    Have a look here:
    http://www.in2hyperion.com/post/2011/03/20/learning-life-cycle-management-(LCM) - command line - security - Synchronization.aspx

    And read about utility LCM - assigned roles under Foundation - and also the Essbase objects.

    Basically, to export security before performing any operation. Then, run an import when you are finished to restore security.

    In addition, you could just check "Copy supply" right click on shared services, application-> Essbase Application (source) groups. It might be easier if you just do something simple.

    Thank you
    Nick

    Published by: Nicholas King on May 31, 2011 12:23

    Published by: Nicholas King on May 31, 2011 12:25

Maybe you are looking for