Sql item - get url from page

Hi I'm trying to display a menu from a table, and then I want to mark the current page in that menu by reading the url of the current page.
This is what i've got so far:
DECLARE
loc Varchar2(40);
BEGIN
loc := htp.script('document.url');
htp.print('<table border=1>');
for rec in (select id, name, parent_id, url from fgj_menu where parent_id=0) loop
   HTP.print ('<tr>');
   HTP.print ('<td><a href="' || rec.url || '">' || rec.name || '</a></td></tr>');
   for rec2 in (select id, name, parent_id, url from fgj_menu where parent_id = rec.id) loop
if rec2.url = loc then
   HTP.print ('<tr>');
   HTP.print ('<td>  >> <a href="' || rec2.url || '">' || rec2.name || '</a></td></tr>');
else
   HTP.print ('<tr>');
   HTP.print ('<td>    <a href="' || rec2.url || '">' || rec2.name || '</a></td></tr>');
end if;
end loop;
END LOOP;
htp.print('</table>');
END;fails on 4th line :
loc := htp.script('document.url');Any suggestions?
Message was edited (format edits) by:
Botzy

Hi Botzy
You can put your javascript code in an HTML portlet, but I prefer to put a page under htdocs, it's much easier to develop, and then use an url item that displays the url directly in the page.
About the code :
var xhr_object = null;
if(window.XMLHttpRequest) // Firefox
     xhr_object = new XMLHttpRequest();
else if(window.ActiveXObject) // IE
     xhr_object = new ActiveXObject("Microsoft.XMLHTTP");
xhr_object.open("POST", "/portal/pls/portal/my_schema.my_proc", true);
xhr_object.onreadystatechange = function()
if(xhr_object.readyState == 4) alert(xhr_object.responseText);
xhr_object.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xhr_object.send('p_param1=value1&p_param2=value2');
That's really simple to use, you just have to change the name of your proc and its parameters, and you'll get what it "htp.prints". Be sure to grant exec to public on you proc.
By the way, I've just imagined an even more simple solution :
- do not pass any param to your procedure. Let it just write always the same code whatever the page it is on
- identify each entry of your menu with a javascript id, for instance
<table>
<tr><td id="url1">page 1</td></tr>
<tr><td id="url2">page 2</td></tr>
etc...
Then use a small javascript code at the end of your page with something lie this :
document.getElementById(document.location.href).style = a different color
or
document.getElementById(document.location.href).innerHTML = something different
or whatever you want.

Similar Messages

  • Is it possbile to get URL from the browser address bar?

    Hi
    I'm in the process of creating a JITIR agent in java that takes in the url of the website that the user presently viewing.
    I don't want the user to have to copy or type in to my app the websites URL. Is it possbile to get this from the process e.g. The browser address bar, or the HTTP:// request sent by the browser.
    Any thoughts gratefully recieved.
    Phil

    I'm in the process of creating a JITIR agent in javawhat's this?
    robert

  • Get Url from all tabs

    Hello,
    I feel like this is something simple but I cannot write a correct script to do it.
    How would I write a script that just gets the urls of all tabs in safari?
    then if one exists, it selects that tab to be opened.

    Would It be easier that instead of telling safari to open that tab if it exists, to set the beginning part of my script that gets info from safari to get info from all tabs, for a specific tab only?
    I don't understand your goals to be able to tell you what you want. Given what you've said in earlier posts it sounded like you wanted to see if a particular URL was present in any tab and if so activate it. That doesn't seem to be the case any more. You'll need to more clearly explain what you're trying to do in order to progress.
    I purchased a book http://apress.com/book/view/1430223618 which I am going to use to better help me make applescripts as well as cocoa-applescript applications in xcode. Do you think this book will be able to help, or is there another I should look at?
    That book, like most others, covers a lot of the theory behind AppleScript - the concepts behind AppleScripts/Apple Events, and things like handlers, process flow, etc.
    It will not tell you how to do what you want, because what you want is something very specific - unique, even. What it might do is give you the fundamental building blocks to work out how to build your script to do what you want. For example, I've shown you some examples of how to find out what tabs are present, how to activate a tab, how to switch windows, etc. The book might do the same thing (albeit spread throughout several chapters). It's a matter of putting that together in a way that achieves your goal.

  • Get URL from Mail message to Safari

    I want to be able to email myself at home from work with a URL in the body of the message. I want a Mail rule and Automator (or applescript if necessary) to take that URL from the message body and send it to Safari which will go to the URL. The URL can be either a web page or downloadable file.
    Quad G5   Mac OS X (10.4.7)   4.5GB RAM

    Shoot! I wrote this huge reply and then quit Safari by accident. I'm too tired to type it all over again (I should install a keylogger).
    Anyway, check out the screen shot of my workflow. the AppleScript section is where it xfers the URL from a text editor (BBEdit) to Safari. It's pretty dirty but it works.
    http://www.jameskocsis.com/urlworkflow.jpg
    post antother reply if you need more data on this process.
    Good luck.
    -James

  • Get URL from HTMLImg

    Hello,
    How do I get the URL from HTMLImg? I get the HTMLImg object from
    GetImageForResultFromSource
    I am using C# in 5.0.4
    Thank you.

    not with Java ... and only if IE actually provides an API that lets you get it. And only if you can get a reference to the IE process.
    It's really more an IE question, not Java.

  • Get URL from within a Ejb-Container

    Hi all,
    I try to realize a WD-Application with Hibernate ORM. Now it seems , that from within the Ejb the hibnerate.cfg.xml couldn't be found.
    No I try to read the URL from hibernate.cfg.xml. There I did some test with the getResource()-Function. At least I managed to get a URL from a zip-archive, but I'm not able to found the URL from something inside the archive, <b>and my configuration is in an archive!!!</b>
    See the following tests:
      URL myurl11 = cl.getClass().getResource("/"); //works
      URL myurl12 = cl.getResource("/"); //works not! (without getClass())
      URL myurl2 = cl.getClass().getResource("/version.txt"); //works
      URL myurl3 = cl.getClass().getResource("version.txt");//works not (relativ)
      URL myurl4 = cl.getClass().getResource("/apps/sap.com/dc~oracle~ear/src/java/src.zip");//works
      URL myurl5 = cl.getClass().getResource("/apps/sap.com/dc/oracle/ear/src/java/src.zip");//works not
      URL myurl6 = cl.getClass().getResource("/apps/sap.com/dc~oracle~ear/src/java/src.zip/de/pa/ejb/systeme/SystemeDao.java");//works not
      URL myurl7 = cl.getClass().getResource("/apps/sap.com/dc~oracle~ear/src/java/src.zip/de.pa.ejb.systeme/SystemeDao.java");//works not
      URL myurl8 = cl.getClass().getResource("/apps/sap.com/dc~oracle~ear/src/java/src.zip/de.pa.ejb.systeme.SystemeDao.java");//works not 
    As you can see with "myurl14" it works for a zip-file but not futher. How can I get Into an archive? Or even adress things relative?
    Can anybody help me?
    Thanks
    Richard

    Hi Joe,
    Thanks a lot for ur reply,
    But the LD_LIBRARY PATH is set to the user that runs the App Server, Since it is throwing a UnsatisfiedLinkError, there must be a problem with the link only(i.e calling native method).
    The flow of data is as follows
    1 A method from ejb calls another java method in an other java class which is in the same jar file,passing the actual arguments.
    2 That java method calls the Native methos residing in the same class file
    3 The Native mentod calls a c function as usual
    My ejb is working fine up to the Native Method call, at this point it is throwing an error
    All my java files are in a package, and my .h file contains package name in the prototype of c function
    If you get any ideas please mail me ASAP
    ThanQ
    Kiran

  • Portal PL/SQL Item - getting connection id for Discoverer

    Finding the connection ID of a connection in Portal PL/SQL item.
    I am using a PL/SQL item in Portal to build a link to Oracle Discoverer.
    Everything is ok; except the user needs to enter a password to login to discoverer.
    I want to start discoverer plus using a private connection. The private connection ID of each user will be different.
    Is there any PL/SQLcode I can use to get this information?
    I am using to PORTAL.wwctx_api.get_user to get userid. I would like to dynamically get the connection id.
    I have hardcoded a private connection id and the link worked fine.
    Since each user has a unique private connection the hardcoding is not practical.
    Any help would be appreciated!! Thanks.

    Hi,
    I'm looking for the same answer. Anything?
    regards
    Malin

  • Cannot remove items in wishlist from page 2 in iTunes 9

    The title pretty much says it all. There are 40 items in our wish list. On page 1 (consisting of 25 items), the little "x" appears to remove an item from the wish list. On page 2, no such "x" occurs, no matter how you hover over the item. Thus, we're stuck with items in the wish list. Any suggestions?
    Thanks,
    Mark

    I found a solution. I went to http://www.tunetribe.com and found 6 of the items from my first page there. I then bought those items and was able to remove them from the first page. I also saved 80p into the bargain as one of them was 49p and the rest 69p. And all 320Kbps mp3 files.
    True that I had to refresh iTunes wishlist for each one I wanted to remove, because the little x's disappeared even from page 1 each time. And true that tunetribe failed to have any of the other 19 items on my front page.
    Having done that, the one I wanted to remove was now on page 1 as well and I could remove that too.
    This needs a serious fix though because I generally just add items then go through various checks like whether I already have it.
    By the way, http://www.amazon.co.uk had close to all of the 49 items I had on my list, and actually I compiled my release list there but I don't like that site. Only 256kbps VBR bit-rate mp3s, and you can't re-download nor does it warn you if you've previously bought the item there, although it doesn't add the same item to your basket twice in one session.

  • How to get urls from urls.

    to be exact, how do i get automator to search urls from current webpage, and then search urls again from those urls i got from my current webpage.
    Thanks in advance!

    Try this;
    * http://techdows.com/2011/09/show-http-in-firefox-7-address-bar.html

  • Get URL from which Flash was downloaded into browser

    Hello buddies,
    Is there any API in ActionScript to identify the URL from
    which Flash was downloaded into browser?
    Thanks

    example (
    http://www.flashkit.com/tutorials/Actionscripting/Basic/Easy_to_-Tiran_Da-674/index.php):

  • Get Url from a text box

    Hello,
    I have read a couple posts in regards to the GEt URL function
    but couldn't find what I'm looking for.
    Trusting someone can help.
    Here are two reference files
    1- Main swf that loads the movie clip
    with the links
    Swf
    that displays the links I'm opening in a new window
    I'm able to open the url on a new window but couldn't find a
    way to control the height of this window. Please note that the
    links are all inside a text box. They are not separate buttons they
    are just text hiperlinks.
    Please let me know if any of you knows how to control the new
    _blank window height.
    Thanks
    Fe

    Hi. You should consider posting this to either the iPhone forum or the Developer forum. This forum is for discussing the Unix subsystem of OS X...

  • PL/SQL Region : Getting values from PL/SQL generated form?  (APEX 2.2.0)

    Hi, all,
    If I've got an PL/SQL region that dynamically generates a form using HTMLDB_ITEM.TEXTAREA, what is the best way to get the contents of those form data at submit time?
    Thanks,
    Don
    Message was edited by:
    Don_84
    Edited for clarity.

    Don,
    The apex_item (nee htmldb_item) functions take an index number as a parameter. So if you give the textarea function p_idx=>1, it creates item f01. If you give it p_idx=>2, it creates item f02, etc. In your after-submit code, access the package variable apex_application.g_fxx where xx is the index number you used.
    Scott

  • Get URL from DMS in SAP

    Hi everybody,
    I have written an ABAP function in SAP where I export a URL of a document in SAP.
    All the images are stored in the DMS server and I fetch the url of the images by the function 'CVAPI_DOC_VIEW'
    When I execute this in SAP everythings works!
    When I execute this in Java webdynpro, the abap program don't find any link?
    Is there something wrong in my code because all parameters are the same.
    Regards

    Karsten,
      Thanks for the reply noted I will recopy this in EP
    Second I tried to get the KM piece to work for a couple of weeks even put in a help note and could not get the folders or any documents to come through any of the KM Browser's on the portal. I created varients etc etc.  So getting frustrated I decided to write my own.  Also because I wanted an iview that would pop all documents based on a picked equipment or material and from the three iviews I saw from KM they didn't seem to do that.  If you know of some documentation that you recommend please let me know
    Thanks Karsten
    Cheers,
    Devlin

  • Getting url from content server with sdok-framework (kpro/dms)

    hi,
    I am trying to get an url for a document with the fm SDOK_PHIO_GET_URL_FOR_PUT but it returns no result.
    I feed the fm with an SDOK_CLASS (thats the phio class?) and a SDOK_DOCID (is this the PHIO?).
    I have the PHIO and LOIO (both for KPro DMS) and the DOKNR (SAP DVS) but I can´t get the url to my existing document.
    has anyone an idea?
    or how can I find out where I could find the correct SDOK_CLASS and SDOK_DOCID from my existing document?
    thank you very much.

    Hello Thorsten,
    have you solved the problem meanwhile ? if not, let me know i had the same issue and it is now solved.
    Johannes

  • Get URL from Chrome and Opera.

    Hello,
    I need to extract the URL and title of currently active tab in Google Chrome and Opera browsers. I manage to do this with Internet Explorer and Mozilla Firefox but having troubles with those two.
    Can someone help me with this issue?
    Would be grateful for a code sample.
    Thanks in advance.

    As far as I know Opera uses QT for the UI (or at least used to use QT in older versions and now uses an different UI frameswork). I assume Chrome also used QT or a similar UI framework. QT is completely different from the normal Windows Controls. You will
    not find anything in a Opera or Chrome Window using SpyXX.
    Therefore there are only a less ways getting the URL. A suitable way could be taking a screenshot and finding the URL bar and doing an OCR on this URL bar.
    Best regards
    Bordon
    Note: Posted code pieces may not have a good programming style and may not perfect. It is also possible that they do not work in all situations. Code pieces are only indended to explain something particualar.

Maybe you are looking for