Accessing OID API from Javascript

Hi,
is there a way to access OID API directly from the client side ? using javascript ? Thanks.
To help you understanding what I intend to do : I need to display a hyperlink but this hyperlink will be dynamic based on the "location" of the current user. This "location" can be found by querying OID.
Thanks.
Jeff

Hi
You don't need client side scripting, neither XMLHTTPRequest. Just write a small PL/SQL procedure on the serveur that will create the link you want based on the current user/location retrieved from OID, then call it for instance with a dynamic page
In a dynamic page, write
begin
portal.my_package..my_proc;
end;
and my_proc on the server would do something like :
declare
lc_url long;
begin
-- retrieve into lc_url the oid info you need for current user, may be using additionnal wwctx_api library
htp.p('<a href="http://my_serveur/' || lc_url || ">link</a>');
end;
Loko

Similar Messages

  • (how) can I access Java APIs from web-page-hosted JavaScript?

    Can I access Java APIs from a web-page via JavaScript if I have a JRE installed on the client machine? And if so, how?
    Thanks in advance for your time and consideration.

    John L. wrote:
    Can I access Java APIs from a web-page via JavaScript if I have a JRE installed on the client machine? And if so, how?As far as I can remember that was actually possible in the very first versions of Netscape because Netscape really wanted to pretend Javascript and Java were meant to be used together. But they soon removed that functionality. Can you guess why?
    Because people were using the File/IO classes to easily steal or remove files on the harddrive, among other such niceties. You do NOT want to have such control from a web application. People will abuse it.

  • How can I access xml document from javascript whithin a JSP page

    how can I access xml document from javascript whithin a JSP page?
    I have a JSP that receives an XML document from a JavaBean, so I can access it within the entire JSP, but I need to access it from the javascript inside the JSP... and I have no idea how i can do this.
    Thanks in advance!

    The solution would only work on MS IE browsers, as other browsers do not support an XML DOM.
    It can be done, but you would be stuck with using the Microsoft broswer. If that is acceptable, I have some example code, and a book recommendation.

  • Access to Data from Javascript

    I have a propertie call it "country" in my "Data View" and I need access its value from javascript code to use in a IF sentence.
    I try thinks such as "xfa.node.getAttribute("country")" but doens't work.
    How can I access it?
    Thanks.

    You can try like this:-
    if(country.rawValue == "IN")
       xfa.host.messageBox ("You selected India");  // This will display a pop-up
    else
       xfa.host.messageBox ("You selected some other country");
    Chintan

  • How to call SOAP API from JavaScript

    Hi,
    I'm trying to call the SOAP API to get statistics about emails. Are there any examples on how to call the API from JavaScript?
    Here is a link to my original question about using the REST API. REST API URL for email statistics
    Thanks,
    Tim

    Tim,
    In order to consume a SOAP API I recommend you use something other than JavaScript.
    Any platform can offer you a good SOAP client should be OK. (.Net, Java, php, Ruby, python).
    I didn't see anyone successfully used javascript and consume the Eloqua SOAP API.
    I know you can create a SOAP client in Java script but it will be too much work to handle the Eloqua response in some cases.
    Regards,
    Daniel

  • Problem with accessing Signed Applet from javascript method

    Hi,
    I am facing the following problem while accessing Signed Applet from javascript method.
    java.security.AccessControlException: access denied (java.io.FilePermission c:/temp.txt read)
         at java.security.AccessControlContext.checkPermission(Unknown Source)
         at java.security.AccessController.checkPermission(Unknown Source)
         at FileTest.testPerm(FileTest.java:19)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
         at java.lang.reflect.Method.invoke(Unknown Source)
         at sun.plugin.javascript.invoke.JSInvoke.invoke(Unknown Source)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
         at java.lang.reflect.Method.invoke(Unknown Source)
         at sun.plugin.javascript.JSClassLoader.invoke(Unknown Source)
         at sun.plugin.com.MethodDispatcher.invoke(Unknown Source)
         at sun.plugin.com.DispatchImpl.invokeImpl(Unknown Source)
         at sun.plugin.com.DispatchImpl$1.run(Unknown Source)
         at java.security.AccessController.doPrivileged(Native Method)
         at sun.plugin.com.DispatchImpl.invoke(Unknown Source)
    I am using jdk1.5 for my development...
    Can anyone help to resolve this security issue. Urgent...
    Thanks in advance.

    Hey thanks. I wasn't able to get it to work with that sample but I did find this very similar code that does allow javascript to call JFileChooser in an applets public method.
    java.security.AccessController.doPrivileged(
    new java.security.PrivilegedAction()
    public Object run(){                           
    //do your special code here
    return null; //return whatever you want
    It seems a bit tempermental in that if you don't select a file quickly, it will hang the browser....no perfect solution but I'm going in the right direction.
    Thanks,
    Scott

  • Access page item from Javascript

    I have searched the forum, and based on my findings this is what I've done so far:
    I have a page item where the Google Map key is stored. I want to access it from Javascript so that I can call the Google map with the key. (Note: The key can't be hardcoded as it will be pulled from DB according to the environment/url the app is running on. e.g. - dev, test, production.)
    Here's a javascript code block:
    <script>
       var google_key = $x('P1_GOOGLE_KEY').value;
       var l_url = "http://maps.google.com/maps?file=api&amp;v=2&amp;key=" +
                   google_key +
                   "&sensor=false";
    </script>I have tried, $v('P1_GOOGLE_KEY') , $x('P1_GOOGLE_KEY') , &P1_GOOGLE_KEY. and none of them work.
    How do I access a page item from Javascript?
    Thx!
    Marc

    Marc,
    I am going to take a shot in the dark, but are you referencing this item outside of a function in your head tag? So basically it tries to reference the item on load? If so this is not going to work because the item does not exist yet. If you are using jQuery change your code to look like:
    $(document).ready(function(){
       var google_key = $x('P1_GOOGLE_KEY').value;
       var l_url = "http://maps.google.com/maps?file=api&amp;v=2&amp;key=" +
                   google_key +
                   "&sensor=false";
    });This will tell the javascript to fire after everything has fully loaded. If you are not using jQuery then you can use a little javascript snippet from here to add a ready event to your page. or you can copy paste this into a script tag.
    (function () {
      var ie = !!(window.attachEvent && !window.opera);
      var wk = /webkit\/(\d+)/i.test(navigator.userAgent) && (RegExp.$1 < 525);
      var fn = [];
      var run = function () { for (var i = 0; i < fn.length; i++) fn(); };
    var d = document;
    d.ready = function (f) {
    if (!ie && !wk && d.addEventListener)
    return d.addEventListener('DOMContentLoaded', f, false);
    if (fn.push(f) > 1) return;
    if (ie)
    (function () {
    try { d.documentElement.doScroll('left'); run(); }
    catch (err) { setTimeout(arguments.callee, 0); }
    else if (wk)
    var t = setInterval(function () {
    if (/^(loaded|complete)$/.test(d.readyState))
    clearInterval(t), run();
    }, 0);
    document.ready(function (){
    var google_key = $x('P1_GOOGLE_KEY').value;
    var l_url = "http://maps.google.com/maps?file=api&amp;v=2&amp;key=" +
    google_key +
    "&sensor=false";
    Good Luck,
    Tyson Jouglet

  • Access selectItems component from javaScript

    Hi,
    In the source below I want to access a selectItems component inside of a selectOneRadio from javaScript. I can access the selectOneRadion as in the code below but I can not the selectItems. Anyone who has an idea?
    <afh:script text='
    function showValue() {
    var test=document.getElementById ("form1:radio1").value;
    alert(test);
    />
    <af:selectOneRadio label="Label 1" id="radio1" >
    <f:selectItems value="1" id="radio2" />
    </af:selectOneRadio>
    thanks in advance

    Hi,
    for a select item the code is
    2nd value of a list
    ================================================
    <input type="button" name="click" onClick="alert(document.form1.select.options[1].value)">
    2nd label in a list
    ====================================================
    <input type="button" name="click" onClick="alert(document.form1.select.options[1].text)">
    selected value
    ==========================================
    onClick="alert(document.form1.select.value)"
    where
    <form name="form1" method="post" action="">
      <select name="select" size="1">
        <option value="1" selected>A</option>
        <option value="2">B</option>
        <option value="3">C</option>
      </select>
      <input type="button" name="click" onClick="alert(document.form1.select.value)">
    </form>
    Frank

  • Accessing UWL API from Web Dynpro Java

    Hi experts,
    I need to retrieve the data from UWL into Web Dynpro java, I have gone through many blogs and solutions but since I am new to portal I am unable to a get hang of it. Can anyone provide me step by step solution including codes for my problem?
    Thanks & Regards,
    Amit Sinha.
    P.S. Points will rewarded.

    Hi Amit,
    just gothrough this below link... here they given the coding also.....
    Accessing UWL-API out of Web Dynpro Java
    it may be helpful to you.... pls comeback if you are struck any where......
    Regards,
    Srinivas.

  • Accessing java classes from javascript

    Hi,
    I have the following javascript function
    function testjava {   
        var myString = new java.lang.String("Hello world"); // line 1
        alert("len:"+myString.length()); // line 2
    }It gives me a error at line 1 saying "'java' is undefined" in IE browser 5.5 sp2. But, both the lines execute correctly in netscape 6.
    Can someone please help..
    Thanks,
    Vijay.

    It seems that IE 5.5 doesn't support accessing java classes in JavaScript, so try to install IE 6 to see if it works or maybe, you doesn't have installed propertly support for JVM in IE.

  • Access Java object from Javascript

    Hi
    I'm trying to invoke a Java object from Javascript (scriptengine and all that).
    I want to add scripting features to a GeneXus Java generated app... and I have very basic skills on java too. Sorry for that ;o).
    This is the java code to pass "params" to the scriptengine:
    engine.put("remoteHandle",remoteHandle);
    engine.put("context", context); The remoteHandle (int) and context (com.genexus.ModelContext) pass trough all the gx-java generated programs.
    This javascript works fine:
    importClass(Packages.uftestjs);
    new uftestjs(remoteHandle).execute( ) ;The remoteHandle conversion is ok (javascript-number to int). The context is optional.
    But if I want to pass context:
    importClass(Packages.uftestjs);
    new uftestjs(remoteHandle, context).execute( ) ;Fails with this:
    "javax.script.ScriptException: sun.org.mozilla.javascript.internal.EvaluatorException: Java constructor for 'uftestjs' with arguments 'number,javax.script.SimpleScriptContext' not found."
    Obviously, no conversion is possible with context (javax.script.SimpleScriptContext to com.genexus.ModelContext).
    There is some way to reference de original context, by the object Id??? or something like that???
    Thanks in advance for any replies!!!
    Greetings from Chile. (I hope you can understand my english!)

    Hi
    Well, since this topic is about java programming I think the place is right here.
    (I use some tricks to embed java statements in genexus objects...)
    I will try to get some help at Artech (GX) on how to build something... to get the conversion needed.
    But they are not focussed on support this kind of questions.
    Anyway, I want to know: do I can to reference an object by the objId?
    I want to code something like this:
    com.genexus.ModelContext context =
                     (com.genexus.ModelContex)getTheObjectFromTheJVM(theObjectId);(powered by google translator, ha!)

  • Accessing pageFlowScope Map from javascript

    I have the following use case
    Model Layer Method - returns a comma-separated string
    Bean Method - Accesses this model layer method and assigns the comma separated string to a pageFlowScope variable (lets say #{pageFlowScope.temp})
    Jsff -
    <af:resource>
    alert('${pageFlowScope.temp}');
    </af:resource>
    What I've been encountering
    1) Lets say the Model layer method return "A,B,C"
    2) The alert is consistent (i.e. in the alert, I get "A,B,C")
    3) In the same session, the model layer method now returns "D,E,F"
    4) The alert is consistent (i.e. in the alert, I get "D,E,F")
    5) In the same session, the model layer method now returns "A,B,C" again
    6) The alert continues to be "D,E,F"
    Basically, unless the return value from model layer changes to something that has not been encountered till that point in time, the alert sticks with the latest value even though the pageFlowScope var changes behind the scene.
    Looks like something to do with caching.
    Also, my af:resource tag is encompassed in a container component (af:panelFormLayout) which means it shouldn't be cached
    Can anyone explain this behavior and how I can always keep my javascript variable consistent with the pageFlowScope var?

    Hi,
    always make sure yo mention the JDeveloper version. Apparently you use JDeveloper 11g R2 and JSF 2 as otherwise using EL in this form is not possible. Anyway, don't rely on people guessing.
    I am wondering why you read the JS from the page flow scope instead of using teh ExtendedRenderKitService to invoke JS on the client
    //Apache Trinidad Class
    ExtendedRenderKitService service = Service.getRenderKitService(FacesContext.getCurrentInstance(), ExtendedRenderKitService.class);
    service.addScript(FacesContext.getCurrentInstance(), "alert('hello world');");For more complex JS string compositions, use the StringBuffer class (which also is better to use if you want to add dynamic data read from a model)
    +"af:resource tag is encompassed in a container component (af:panelFormLayout) which means it shouldn't be cached"+
    No guarantee that this is not cached unless you partially refresh the surrounding component. Still then, your EL uses "$" which is an immediate call upon JSF compile time whereas PPR is deferred. Using the extended renderkit service is the better way of solving your coding issue
    Frank

  • Access private variables from javascript

    Hi.
    How can i access my objects and varibles, in my java code from my javascript.

    Try displaying the value before you assign it.
    If you wanna display the value of a text field called textCallClass, this is the javascript code:
    alert(document.getElementById("form1:textCallClass").value);
    And if you wanna display a field called uniqueNum from a page called
    SchemeHolders, this is the javacsript code:
    alert(#{SchemeHolders.uniqueNum});
    You have ro have a public function called getUniqueNum in SchemeHolders.java. And ensure the case is exactly like mine is.
    That does work fine in my programs, if you have any other problems, post the error message.

  • Accessing AIR API from loaded SWFs

    I am relatively new to AIR development and I can't get my head a round a little issue. I have an AIR application created in Flash CS5 that is just a shell that loads modules on demand, those modules are just SWF.
    I would like to access the AIR API directly from the classes of those SWF but of course they don't compile because in the publish settings they are just exported for Flash player 10 and don't see the AIR API. I tried adding airglobal.swc to the library hoping it would sort out the compiling problem but it doesn't and it generates many errors.
    I use to develop with MDM ZInc and I would just import the MDM SWC in any classes that would want access the MDM API, I am unsure how to proceed with AIR.
    Any help would be appreciated.
    Calwen

    Hi Calwen,
    here is basic sample how you could achieve that. Note: I'm using mxml syntax and components - but the *KEY* is api use of LoaderContext - not what real components are used to model UI.
    Say I have host:
    <?xml version="1.0" encoding="utf-8"?>
    <s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009"
                                xmlns:s="library://ns.adobe.com/flex/spark"
                                xmlns:mx="library://ns.adobe.com/flex/mx"
                                creationComplete="creationCompleteHandler(event)">
         <fx:Script>
              <![CDATA[
                   import mx.events.FlexEvent;
                   protected function creationCompleteHandler(event:FlexEvent):void
                        var loaderContext:LoaderContext = new LoaderContext();
                        loaderContext.allowCodeImport = true;
                        swfLoader.loaderContext = loaderContext;
                        swfLoader.load("app:/MyLoadedApp.swf");
              ]]>
         </fx:Script>
         <s:SWFLoader id="swfLoader" width="100%" height="100%"/>
    </s:WindowedApplication>
    MyLoadedApp is not created with air SDK at all - it is just flash.display.Sprite movie clip created with any compatible Flash compiler:
    package
         import flash.display.Sprite;
         import flash.events.*;
         import flash.text.TextField;
         import flash.utils.getDefinitionByName;
         public class MyLoadedApp extends Sprite
              public function MyLoadedApp()
                   addEventListener(Event.ADDED_TO_STAGE, initApp);
              protected function initApp(addedToStageEvent:Event):void
                   removeEventListener(Event.ADDED_TO_STAGE, initApp);
                   var clazz:Class = flash.utils.getDefinitionByName("flash.filesystem.File") as Class;
                   if(clazz)
                        // we could read documents directory (File.documentsDirectory) using class access
                        var directory:Object = clazz.documentsDirectory;
                        try
                             // and we could show browse dialog (now we are using instance - not class)
                             directory.addEventListener(Event.SELECT, directorySelectedHandler);
                             directory.browseForDirectory("Please select directory");
                        } catch (error:Error)
                             // handle error
                             var errorText:TextField = new TextField();
                             errorText.autoSize = "left";
                             errorText.text = error.message;
                             addChild(errorText);
              protected function directorySelectedHandler(selectEvent:Event):void
                   var directory:Object = selectEvent.target;
                   var files:Array = directory.getDirectoryListing();
                   var resultsTextField:TextField = new TextField();
                   resultsTextField.autoSize = "left";
                   resultsTextField.multiline = true;
                   resultsTextField.appendText(selectEvent.type+":\n");
                   for(var i:uint = 0; i < files.length; i++)
                        resultsTextField.appendText(files[i].name+"\n");
                   addChild(resultsTextField);
    This is not safe at all and loaded module can do everything I think (we talk about local modules from app storage, like in Zinc, right?)
    kind regards,
    Peter

  • Accessing Flash params from JavaScript

    Folks,
    I am starting out on Flex/Flash so if I am confusing
    terminology please let me know.
    I have a web page with video section (like in YouTube) using
    Flash and I have a button outside that section, on the regular html
    part of the page. When I click that button I want to somehow go to
    the Flash code playing the video and extract the elapsed time that
    the video has played for e.g. if the video has played for 2 min and
    18 secs I want to get that back and display in an html label.
    From the research I have so far I find only the events going
    out of Flex/ActionScript but I couldn't find a way to have a
    JavaScript call come in and grab that information. Any thoughts on
    how I can do that or if I should be posting this somewhere else? I
    am using Rails so if there is anything pertinent to that that will
    be helpful.
    Thanks,
    Sanjay.

    Look into ExternalInterface. That will do wht you want.
    Tracy

Maybe you are looking for

  • Open hyperlinks in new window/tab/pop-up ?

    Now that my hyperlinks are working again.... I have a section with "directions" to lots of locations, each location has a google map link and a link to a pdf , when the user clicks on a link for a PDF or google map etc, it comes up fine but when you

  • How do I use "back to my mac" with iCloud?

    Can't seem to find any info on this. Need to know how to use this service.

  • ILife suite missing after hard drive issues

    I recently had an issue with my hard drive which required it to be wiped, with a reinstallation from an external hard drive. I went to a Genius Bar and they explained that Time Machine had failed to backup my applications, and said that while they'd

  • Link to documents stored in database on flext front end

    Hi, I am a newbie to Flex.Can you please help me out with the procedure as how I can to provide a link on flex front end screen which when clicked opens either pdf's,ppt's,word docs from database. I am integrating the flex with spring and hibernate a

  • SAP Installation Error on DB2 V 9.1 FP 9 on Windows 2008 R2

    Hi , I have struck in middle of the NW 7.0 EHp1 SR1 (EP 7.01) installation with the following error at step 9: Create Database ports. Technical details are : Windows 2008 R2, IBM DB2 V 9.1 FP 9. I Could not find any clues to fix this error. I Would a