calling a method from javascript bean

Hi forum,

I was wondering if it is possible to call a method of bean managed from javascript. Why do I need it? Because I want to implement a simple javascript and light confirm dialogue resulting (Y or N) determines if the call or not a method that could achieve a vo. To be more precise, I hava a table only reading and I want to give the user the option to select a single line and remove it without taking to another page but confirming a javascript dialog box.
Thank you very much in advance.

Alberto

Yes,

.. You should forget about it. 10.1.3 doesn't have a callback method in controlled beans. In theory, you can create a filter for the faces servlet and pass a parameter of specific application as a flag with the request, so the filter can attempt to access the bean managed and put some information below. However, on the client side you would issue such a XMLHttpRequest

Frank

Tags: Java

Similar Questions

  • Call the method from another application

    Then. That is my question. Is it possible to call a method from another application, so I can get some data from this app?

    I know that I could also do this with persistent store, but I would like to do it this way.

    Thank you. I'll try with world events and TIME store.

  • Error when calling a method AM of Bean managed

    Hi friends,

    JDev's Studio Edition Version 11.1.2.4.0

    I have a page (HomePG) that has a read-only table. Select a field in the table and you enter a value for the inputText and then clicking on a button, the selected employee's salary should be replaced by the value entered in the inputText field.

    I am trying to call a method of the managed bean AM and I get an error while doing this. I created a link to the method in the page where the call is made.

    Here is the code of the AOS

    ' Public Sub hikeSelectedRow (Key key, BigDecimal val) {}

    ViewObjectImpl emp = getEMPVO1();

    RowSetIterator empVO = emp.createRowSetIterator ("Test");

    System.out.println ("in selected Update");

    System.out.println ("in selected, Update key:" + key);

    Row [] selectedEmpArr;

    selectedEmpArr = empVO.findByKey (key, 1); -> Error comes here

    System.out.println ("in selected, Update key:" + key.toString ());

    EMPVORowImpl selectedEmp = (EMPVORowImpl) selectedEmpArr [0];

    selectedEmp.setSal (selectedEmp.getSal () .add (val));

    System.out.println ("added, made Bravo");

    getTransaction () .commit ();

    }

    The line is selected in the Managed bean and is also selected. However during appraisal findByKey get the performance I get the below error. Can someone please.

    The error I get is

    < ActionListenerImpl > < processAction > java.lang.NumberFormatException: for input string: "[oracle.jbo.Key [7566]].

    javax.faces.el.EvaluationException: java.lang.NumberFormatException: for input string: "[oracle.jbo.Key [7566]].

    at org.apache.myfaces.trinidad.component.MethodExpressionMethodBinding.invoke(MethodExpressionMethodBinding.java:51)

    at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)

    at org.apache.myfaces.trinidad.component.UIXCommand.broadcast(UIXCommand.java:190)

    to oracle.adf.view.rich.component.fragment.ContextSwitchingComponent$ 1.run(ContextSwitchingComponent.java:130)

    at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent._processPhase(ContextSwitchingComponent.java:461)

    at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent.broadcast(ContextSwitchingComponent.java:134)

    at oracle.adf.view.rich.component.fragment.UIXInclude.broadcast(UIXInclude.java:112)

    to oracle.adf.view.rich.component.fragment.ContextSwitchingComponent$ 1.run(ContextSwitchingComponent.java:130)

    at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent._processPhase(ContextSwitchingComponent.java:461)

    at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent.broadcast(ContextSwitchingComponent.java:134)

    KeyVal key = new key (new Object() {Integer.parseInt (((List) tableIterator.next ()) m:System.NET.SocketAddress.ToString ())});

    So, what will return: (tableIterator.next ()) m:System.NET.SocketAddress.ToString () (list)?

    I suppose this relates a strange string?

    Check out this blog for a correct use of the RowKeySet (and is also described in a easier way to get the current line in the case of single selection): ADF:TABLE - Get selected or lines. John Brunswick

    Dario

  • Call a procedure from javascript

    Hello

    I would like to help on the following please.

    I have a JavaScript in page region 'function and Global Variable declaration ':
    function openUrl(pUrl) {
      window.open(pUrl,"_blank","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes, copyhistory=no, width=1024, height=768");
    }
    In the same page one have a number of standard reports. A number of columns in each of these reports sets a link. The binding for all the columns settings are defined as follows:
    Target: URL
    URL: javascript:openUrl('http://#SERVERNAME#:9704/xmlpserver/Publications/Dock_Report.xdo?_xpf=&_xpt=0&_xdo=%2FPublications%2FDock_Report.xdo&_xmode=4&_paramsID_USU=#ID_USU#&_paramsIDCR=#IDCR#&_paramsIDCU=#IDCU#&_xt=DPol_Layout&_xf=pdf&_xautorun=true');
    As you see, the user of the application, click on the link on the column of the report and a popup is generated showing the report. It all works very well.

    My requirement is to call a procedure from the augments that are included in the column link that was clicked by the user of the application.
    #ID_USU#
    #IDCR#
    #IDCU#
    My question is how to achieve this as the url is inside a call to javascript?

    Can I use the Javascritp set in the page to extract the details, and then use javascript to call a procedure?

    Any help, pointers, ideas, everything is welcome.

    Request Express 4.0.2.00.07

    Thank you

    Published by: zooid on 4 April 2013 22:47

    Have you seen this javascript API? http://docs.Oracle.com/CD/E17556_01/doc/apirefs.40/e15519/javascript_api.htm#BGBJHEHG

    It has very convenient function: apex.submit (pOptions);

    Specify the target URL as:

    JavaScript:rowClick('#ID_USU#',_'#IDCRM#',_'#IDCU#');

    Then add a function to your page somewhere:

    function rowClick(idUsu, idcrm idcu){
    
      openUrl(/*url*/);
      apex.submit({request: "SOME_REQUEST_VALUE", set: {Px_ID_USU: idUsu, Px_IDCRM: idcrm, Px_IDCU: idcu}});
    
    }
    

    (Where you have page elements for each of the items that you want to set.

    Then you can have a process of PL/SQL page, under condition of request = expression 1, term 1 = SOME_REQUEST_VALUE

    And do you want to ;-)

  • What is the best way to call a method in the bean on the adf page loading?

    Hello

    which is the best way to call a method in managing the beans on the adf page loading.

    My version of jdev 11.1.1.5.0

    Thank you

    I don't know if it's the right answer for your question try this...

    In taskflow for properties of method call, you must return a value when you use #{pageFlowScope.returnvalue} (returnvalue is a variable), so you can use your return value in the taskflow... Please let me if this is correct...

  • How to call a method to support bean when change the af:panelTabbed tab?

    I use component af:panelTabbed and want to call a method of bean support when change tab. I tried to use itemListener on af:showDetailItem, but it's not working. and use clientListener / serverListener to call the backup method does not work either.

    Hello

    use the earpiece of the disclosure on the detail element

    http://download.Oracle.com/docs/CD/E15523_01/apirefs.1111/e12419/tagdoc/af_showDetail.html

    Frank

  • Cannot call the functions from Javascript using ExternalInterface

    Hi all, I use external Interface to call Javascript in an HTML document with an embedded flash object, but I can't call functions in the flash JavaScript object.

    JavaScript:
    function call_actionscript {}
    If (document.getElementById ('flashObj')) {}
    Alert ('object flash found.');
    document.getElementById('flash2').test_from_javascript ();
    }
    }


    ActionScript:

    package {}
    import flash.display.MovieClip;
    to import flash.external.ExternalInterface;
    import flash.events.Event;

    SerializableAttribute public class extends MovieClip {} FlashObj
    public void FlashObj() {}
    ExternalInterface.addCallback("IsStatic",IsStatic) ('test_from_javascript', test_from_javascript)
    }

    public void test_from_javascript(e:Event):void {}
    ExternalInterface.call("saveglobalscore",score) ("alert", "javascript test received in actionscript!")
    }
    }
    }

    Call the "call_actionscript()" javascript function produces no result. Call Test_from_javascript() manually to code Actionscript product alert "javascript test has received in actionscript!" without problem. So the ExternalInterface.call("saveglobalscore",score) method works fine, but the the ExternalInterface.addCallback("IsStatic",IsStatic) doesn't seem to work at all. What I'm missing here?

    Try to change/add the JS in your HTML code to the following.

    TS

  • How to call a method public applicationModuleIMPL bean managed

    Hi all

    How can I call a method public amimpl in my bean managed

    my version of jdev is 11.1.1.2.0

    Thanks in adv

    Please see the developer's guide:
    http://download.Oracle.com/docs/CD/E12839_01/Web.1111/b31974/bcservices.htm#sm0212
    First, the method must be exposed in the interface of the client of the AOS.

    (The link is 11g dev guide).

  • ADF: Can I call java method clsss javascript function in the ADF?

    Hello

    I want to call the javascript function in the Java class method, it is possible in the ADF? If Yes, how?

    or I need to use Java 6 function directely?

    Kind regards
    Deepak
    private void writeJavaScriptToClient(String script)
    {
    FacesContext fctx = FacesContext.getCurrentInstance();
    ExtendedRenderKitService erks = Service.getRenderKitService(fctx, ExtendedRenderKitService.class);
    erks.addScript(fctx, script);
    }
    

    its use

    StringBuilder script = new StringBuilder();
    script.append( "var popup = AdfPage.PAGE.findComponentByAbsoluteId('p1');");
    script.append("if(popup != null){"); script.append("popup.show();"); script.append("}");
    writeJavaScriptToClient(script.toString());
    

    Timo

  • Cannot call function AS3 from JavaScript

    Hello

    I am trying to call a function in ActionScript 3 with JavaScript. The problem that I can't get one of the browsers to trigger this AS3 function. Debuggers to say that the function is not defined when I call on the flash object.

    What is supposed to happen is - the javascript function calls the AS3 function and passes an integer value.   This integer is then used to remove one of the 20 funds sovereigns and load that into the flash movie.

    Please let me know if you can think of everything I can do to make it work!  I've been blocked for hours and can't seem to get there.

    Here are my actionScript:

    import flash.net.URLRequest;

    import flash.display.Loader;

    to import flash.external.ExternalInterface;

    var movies: Array = ["idle - ok.swf ',"idle - good .swf"];

    First, it loads it "Hello swf»

    var helloLoader:Loader = new Loader();

    var helloURL:URLRequest = new URLRequest ("idleAvatar.swf");

    helloLoader.load (helloURL);

    addChild (helloLoader);

    var setAvatar:Function = loadAvatar;

    ExternalInterface.addCallback("IsStatic",IsStatic) ("callSetAvatar", setAvatar);

    Then, this function must be called by JavaScript to load one of the other sovereign wealth funds.

    function loadAvatar(indx:Number) {}

    var url: URLRequest = new URLRequest(movies[0]);

    var ldr:Loader = new Loader();

    LDR. Load (URL);

    addChild (ldr);

    }

    Here's my JavaScript:

    "<script type="text/javascript"> ".

    function callExternalInterface (val) {}
    document.getElementById("loader").callSetValue (val);
    }
    < /script >

    Here is my embed code:

    <div >

    "" " <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="250" height="350" id="charger" name="loader"> .

    " <param name="movie" value="loader.swf"/ >

    " <param name="allowscriptaccess" value="always"/ >

    <!--[if ! IE] >->

    "" <by typeobject = "application/x-shockwave-flash" data= "loader.swf" width= "250" height= "350" > ""

    " <param name="allowscriptaccess" value="always"/ >

    <!-<! [endif]-->

    " <a href="http://www.adobe.com/go/getflashplayer_fr"> ".

    " <img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player"/ >

    </a>

    <!--[if ! IE] >->

    < /object >

    <!-<! [endif]-->

    < /object >

    </div>
    "<a href="#" onClick="callExternalInterface (1)' >click ON < /a > ""

    You don't appear to be calling any function in your actionscript code.  Names between and inside are in disagreement.

    document.getElementById("loader").callSetValue (val);

    must call a function identified by the string "callSetValue" in your actionscript code, but you only have an identified with "callSetAvatar" and the function associated with the one on your side AS3 is specified as setAvatar...

    ExternalInterface.addCallback("IsStatic",IsStatic) ("callSetAvatar", setAvatar);

    but you do not have a function named setAvatar, you have a named loadAvatar

    Here is a link to a tutorial that can help you see how the functions are specified between actionscript and javascript using the ExternalInterface class.  He becomes confused, I suggest that you copy the code into a word processing file, so you can put clear where they have the same language between them.

    http://Viget.com/inspire/bi-directional-ActionScript-JavaScript-communication

  • Simple enough, but calling one method from another class

    Hi all
    I know it's pretty simple, even though I do not see where I am going wrong for some reason any. Basically, I have a class that extends JPanel but when I try to call one of its methods in my main class I get an error. The code (I hope) is:

    Main.Java
    import java.awt.BorderLayout;
    // ...
    import javax.swing.UIManager;
    
    public class Main extends JFrame implements ActionListener {
    
         JFrame frame;
         public static JPanel statusBar;
    
         public Main() {
    
              // ...
    
              // Add a status bar
              statusBar = new StatusBar();
              mainPanel.add( statusBar, BorderLayout.SOUTH );
    
              setContentPane( mainPanel );
              // ...
         }
    
         // ...
    
         public static void setStatusBarText( String s ) {
              statusBar.setStatusText("Test");
         }
    
         // ...
    }
    StatusBar.java
    import java.awt.Color;
    // ...
    import javax.swing.SwingConstants;
    
    public class StatusBar extends JPanel {
    
         private int barWidth;
         private static JLabel status;
    
         public StatusBar() {
              super();
              //barWidth = Main.getProgramWidth();
              //setPreferredSize( new Dimension(barWidth,22) );
              setLayout( new FlowLayout( FlowLayout.LEADING ) );
              setBorder( BorderFactory.createMatteBorder(1, 0, 0, 0, new Color(160,160,160) ) );
    
              status = new JLabel("Test", SwingConstants.LEFT);
              //status.setVerticalAlignment( SwingConstants.CENTER );
              add( status );
         }
    
         protected void setStatusText( String s ) {
              status.setText( s );
              revalidate();
         }
    }
    The "statusBar.setStatusText ("Test")"; call in the main class file does not work and I get the error:

    >
    cannot find symbol
    symbol: setStatusText (java.lang.String) method
    Location: class javax.swing.JPanel
    statusBar.setStatusText ("Test");
    >

    Any ideas what I am doing wrong? I created an instance of the class called status bar StatusBar, can I use it to call the setStatusText() method (via statusBar.setStatusText ()) I thought everything is OK, then it does not work? Even if there is an easier way to do what I want to achieve (i.e. to update a JLabel since the 'central' main class file instead of setting the JLabel static and have all classes call him directly), I'd be glad to know where I am going wrong here nevertheless.

    Thank you very much
    Tristan
         public static JPanel statusBar;
    
         public static void setStatusBarText( String s ) {
              statusBar.setStatusText("Test");
         }
    

    >
    cannot find symbol
    symbol: setStatusText (java.lang.String) method
    Location: class javax.swing.JPanel
    statusBar.setStatusText ("Test");
    >

    The type of variable statusBar is JPanel. That's all the compiler takes into account. It is not relevant that at a certain point in the program, the type of the object pointed to by this variable is a subclass of JPanel (because at another time, it might be an instance of another subclass or JPanel itself.

  • A simple way to call PL/SQL from javascript?

    Hello
    I have a page with 2 fields and a button. In both areas, the user put 2 different customer numbers and when they click the button must call a PL/SQL procedure that will merge the customer News #1 in the #2 client.
    I would like to show the user a before confirmation dialog box accepts eventually merge the two clients.

    How can I do?

    Thanks in advance...

    AJAX is fine if you don't need to refresh the page, but if you just need a simple process you can build as simply a page process runs under condition based on a certain application (such as FUSION). Then have your button call the javascript and call doSubmit in it - as follows:

    
    

    You put the code above in the header, and then set the redirect URL on your button to call:

    javascript:merge();
    
  • Call a method to support bean after selection to select only one option

    Hi all

    I'm new to Jdeveloper 11 g, and I'm trying to trigger a method once the user makes a selection on a 'select one choice' (JSF page).

    I have a (backing bean) method that reads the selection and runs a procedure that retrieves data and that fills the input text A and B, unfortunately this is implemented using an af: button and I would that this method to trigger automatically after the user makes the selection without clicking the button. Can you help me?

    Thank you

    Mike.

    Use valueChangeEvent and selectOneChoice autoSubmit = 'true '.

        public void selectOneChoice1_valueChangeListener(ValueChangeEvent valueChangeEvent) {
            if(valueChangeEvent.getNewValue() != null)
         ......
            }
        }
    
    
    
  • How to call a method when it is clicked on selectBooleanCheckbox?

    Hello experts!

    I use Jdev 12.1.2 and I'm currently calling a method in a Bean managed using an af:button and works great:

    <af:button id="b1"
             icon="/images/icons/highlighted.png"
             actionListener="#{backingBeanScope.pppProjectsBean.toggleHighlighted}"
             text="#{sessionScope.highlighted_only ? 'Show All' : 'Show Highlighted Only'}"
             immediate="true"/>
    

    My requirement is to change the button for a selectBooleanCheckbox, but the attributeChangeListener method is not executed:

    <af:selectBooleanCheckbox text="Show Only Highlighted Projects"
       label=" id="sbc1"
       attributeChangeListener="#{backingBeanScope.pppProjectsBean.toggleHighlighted}"
       immediate="true">
    

    What are the 3 codes methods in the managed bean:

        private void toggleHighlighted() {
            <code tested and working fine>
        }
        //For the action listener of the button
    
        public void toggleHighlighted(ActionEvent actionEvent) {   
            toggleHighlighted();
        }
       //For the attribute change listener of the checkbox    
        public void toggleHighlighted(AttributeChangeEvent attributeChangeEvent) {
            toggleHighlighted();
        }
    

    Thanks in advance,
    Jose.

    Use valuechangeListener.

  • call method before managed Bean support page

    Hi guys,.

    My Version of Jdev is 12 c. I want to call a method of bean managed before my Page load. I did an EnableDisableMethod() method in my managed Bean that is my default activity in my taskflow. This method is only how to turn off to some of my Page buttons. I use * in my control flow so that my page will be called each time after the execution of my method by default. But what my result will be fixed for my activity method. Also what is the use of the result sets.

    <-l' id = 'enableDisable' method call >

    < method > #{pageFlowScope.bgBean.enableDisable} < / method >

    < result >

    < / results >

    < / method >

    Also when I run that application.page is empty but in newspaper that comes

    < 23 June 2014 12:41:30 IST > < WARNING > < oracle.adfinternal.controller.metadata.model.xml.PageFlowXmlImpl > < BEA-000000 > < ADFc: /WEB-INF/bGMstTF.xml #bGMstTF: >

    < 23 June 2014 12:41:30 IST > < WARNING > < oracle.adfinternal.controller.metadata.model.xml.PageFlowXmlImpl > < ADFC-52024 > < ADFc: duplicate managed definition of bean to "bgBean" detected. >

    < 23 June 2014 12:41:30 IST > < WARNING > < oracle.adfinternal.controller.activity.MethodCallActivityLogic > < ADFC-56013 > < ADFc: Exception when the assessment call to method activity expression EL "#{pageFlowScope.bgBean.enableDisable}". >

    When I'm debugging its my default front method call load.but page does not redirect to my page. I think that the problem with my key component.before page load it does not know my button

    mainBtnAdd.setDisabled (true);  It is here, I think what he does ' t know button until pageLoad.mainBtnAdd is null in debug mode.

    Thank you

    Raul

    Oh and Yes your button is known that once the page is rendered. To solve your problem you add to the bean (Boolean or string) which then reference you via el of the property of button on the properties page. In method you you set just the properties of the bean.

    Timo

Maybe you are looking for