JavaScript in JSPX and run after the page loads?

I want to insert some JavaScript to my file jspx, but his does not work... I did this way:
<?xml version='1.0' encoding='UTF-8'?>
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"
          xmlns:f="http://java.sun.com/jsf/core"
          xmlns:af="http://xmlns.oracle.com/adf/faces/rich"
          xmlns:trh="http://myfaces.apache.org/trinidad/html">
  <jsp:directive.page contentType="text/html;charset=UTF-8"/>
  <f:view locale="#{actionAvailable.userLocale}">
    <af:document id="d1" title="#{bindings.title.inputValue}">    
      <f:loadBundle basename="oracle.bpel.services.workflow.worklist.resources.worklist"
                    var="resources"/>
      <trh:script source="/jsLibs/taskDetails.js" id="s1"></trh:script>

    <!-- //I ADDED THIS -->
    <f:facet name="metaContainer">
        <af:group>
            <trh:script>
               function myFunction()
               {
                alert("function called");
               }
            </trh:script>
        </af:group>
    </f:facet>
    <!-- //END OF SCRIPT -->


    <!-- //I WANT TO RUN MY FUNCTION AFTER PAGE IS LOADED -->
      <BODY onload="myFunction();">
      <af:form id="f1" usesUpload="true">
        <af:panelGroupLayout layout="vertical" inlineStyle="padding:5px;"
                             id="pgl5">
          <af:panelLabelAndMessage id="id12" label="">
            <af:goLink text="Click here" id="link"
                       destination="#{LinkCreator.link}#{bindings.taskNumber.inputValue}"
                       targetFrame="_self"/>
          </af:panelLabelAndMessage>
        </af:panelGroupLayout>
      </af:form>
      </BODY>



    </af:document>
  </f:view>
</jsp:root>
As you can see, I just very simple jspx file and all I want to do is to run myFunction() after loading the page.
So I inserted a very simple script with 1 function that handles the simple alert (I followed this instructions http://adfcodebits.blogspot.com/2010/03/bit-3-adding-javascript-to-jspx-page.html).
I also added BODY onLoad, but nothing happens...

What's wrong?

Published by: user1175491 on November 11, 2010 11:55

Try this:



function someFunction() {}
Alert ("OnLoad");
}


you don't have to use the body tag

Published by: Nikhil Gokhale on November 11, 2010 19:18

Tags: Java

Similar Questions

  • JavaScript in "Run when the page loads", works not when paginating the results grid

    I have some Javascript in a page of the Apex, running in "run when the page loads. There is stuff to a grid of results. It works fine on the loading of the page, but then does not work when I paginate (Browse), or sort the grid. I assume that this is because the grid is sorted / paged using Ajax, which means that the page is not fully loaded.

    Is there anywhere else I can put the code, so it is applied to the grid on the kinds and paging?

    Yes you are right when you paginate it doesn't reload the page (at least in this case).

    You must use the event after Refresh in the dynamic actions and run javascript also, you would probably need the dynamic scope

    17.9 implementation of dynamic Actions

  • Hide filter interactive report dynamically after the page load

    Hello

    I try to hide the section of interactive report filters (hide/show the area with +/-sign on the top of the report) the loading of the page

    I have the reference to the thread after http://apex-at-work.blogspot.com/2011/02/hide-interactive-report-filter.html posted by Tobias Arnhold...

    According to the expert, all I have to do is post the following code the code JS "page loading" within a dynamic action...


    / * Hide filter IRR after page load * /.
    If ($('#apexir_CONTROLS_IMAGE').attr ("src") == ' / i/minus.gif ') {}
    gReport.toggle_controls ($x ('apexir_CONTROL_PANEL_CONTROL'));
    }

    I did, but apparently it does not work for me...

    I posted a sample on APEX. Oracle.com for review and comment

    Thank you

    Edited by: qwe12654 may 3, 2011 19:15

    Hello

    01. in the report Footer region put this

    
    

    * This will hide your filters, highlight conditions

    02. then Goto 'Report attributes' => 'Search Bar' => for 'Include search bar' select 'no '.
    * This will hide the full search bar (do this only if you want to hide this part)

    * If you get the answer then mark as 'Correct '.

  • Validation of required field only when the page loads (HR test case!) included

    Hi experts,


    Here you have a simple test for Jdev 12.1.3 HR case: https://dl.dropboxusercontent.com/u/18609389/TestHR.zip

    The main.jspx is just a button which CreateInsert a record dept displayed in another page:

    Screen Shot 10-16-14 at 07.04 PM.PNG

    My problem is the following page (test.jspx) has this code to run when the page loads:

    <af:serverListener type="onloadEvent" method="#{backingBeanScope.backinBean.onPageLoad}"/>
                <af:clientListener method="onLoadClient" type="load"/>
                <af:resource type="javascript">
                  function onLoadClient(event) {
                      AdfCustomEvent.queue(event.getSource(), "onloadEvent", 
                      {
                      },
    false);
                      return true;
                  }
                </af:resource>
    

    The code is simply this (now):

        public void onPageLoad(ClientEvent clientEvent) {
            logger.severe("HR TEST.....");
        }
    

    And that's the problem, required validation is performed.

    Screen Shot 10-16-14 at 07.06 PM.PNG

    Can you tell me why?

    Thank you

    Jose.

    Don't know what is my mistake, but the code is of the actionListener button is not called. :-(

    Well, you combined two different ways to do this (from my first answer).

    If you are still reading this, you will notice "or" before the second suggestion

    Thus,.

    1. keep your clientListener under af:document tag

    2. based on javascript, you find key (use: alert ("button");)  to see if you have referenced correctly your button in findComponentById())

    And then:

    approach 1:

    Use AdfActionEvent.queue (button, true);  queue event on your action button and implement your logic in function attached to the properties of your 'actionListener' or 'action' button (if you don't need listener server in this case)

    approach 2:

    Use AdfCustomEvent.queue (button, "onloadEvent", {}, false);  the queue onloadEvent on your button (in this case you need listener server attached to your button)

    Dario

  • When I send emails to others after cut and pasting of information, it runs off the page and is not readable on their computers.

    If I cut and paste a message to a person in a Hotmail e-mail message, more often it runs off the page on other machines and they can't read.  How to fix this?

    Hi Joanne,

    The question you have posted is related to Windows Live Mail and would be better suited to the Discussion Windows Live groups. Please visit the link below to find a community that will provide the support you want.

    Windows Live Forum: http://windowslivehelp.com/product.aspx?ProductID=1

  • Windows Update does not work after you reinstall Windows XP SP3, get error: "the site has encountered a problem and cannot display the page you are trying to view.

    Original title: cannot run Windows Update

    I just reinstall my Windows XP and SP3, but I can't run Windows Update and gives me the following error message:

    The website has encountered a problem and cannot display the page you are trying to view. The options provided below may help you solve the problem.

    For self-help options:

    To support options:

    Can someone help me please?  Thank you.

    I just reinstall my Windows XP and SP3, but I can't run Windows Update and gives me the following error message:

    The website has encountered a problem and cannot display the page you are trying to view. The options provided below may help you solve the problem.

    For self-help options:

    To support options:

    Can someone help me please?  Thank you.

    [1] select start > run > wuaucpl.cpl > disable automatic updates > apply (if the setting is changed) > OK

    To disable the horse notification that appears in the status bar on automatic updates is turned off.

    Go to start > Control Panel > Security Center > resources > change the way Security Center alerts me > uncheck automatic updates

    [2] manually download the full install for IE8 exe and install IE8 and refuses to download updates at the time of the installation of IE8

    http://www.Microsoft.com/en-us/download/Internet-Explorer-8-details.aspx

    [3] manually download and install the latest cumulative security for IE8 update and restart the computer before

    visit windows update via the shortened link in your Start menu.

    When you have Win XP SP3 and IE8, it will be the necessary file recommend you download and save the file in the folder, and then double-click on and run the executable file from there.

    http://download.Microsoft.com/download/1/9/A/19A6AC47-9EA0-455F-B918-A44D25B5304C/IE8-WindowsXP-KB2898785-x86-enu.exe

    Restart after installing IE8 cumulative security update.  It should restart when installation is complete.

    [4] now to connect to windows update manually through your browser using the shortcut in the start menu link.  Ignore the warnings, recommendations to turn on automatic updates.

    Report back please on the status and please report problems with error codes. Thank you.

    Recommend you not install MSE but rather install a free antivirus like Avast or AVG.

    Recommend also you do not install Windows Search 4.0 these programs not to live pleasantly on most XP machines and cause CPU excessive loading unpredictable and inconveniently sometimes interfering with the usual ability to XP if not to multitask without problems.  Also recommend you only install Firefox is a browser much better than IE8 that will not work even at many Web sites.

  • Error manually running Windows updates "the website has encountered a problem and cannot display the page you are trying to view. The options provided below might help you solve the problem.

    Original title - manual update of Windows XP via "Windows Update" fails

    07/01/14: click on "Windows Update" on the desktop (XP Home) and XP Tablet

    Result: 'the site has encountered a problem and cannot display the page you are trying to view. The options provided below may help you solve the problem. »

    This office has begun on about 3 days ago and just this morning appeared on the Tablet

    I do McAfee and Microsoft updates manually every morning after the startup of computers so that they will not automatically be updated when I'm busy with other things

    I suspect that the McAfee via Verizon security package is the culprit since the 'look' of their package and procedures changed end of December

    Since then, they have had updates almost every day

    And around the same time, my problem appeared on XP Home Edition, I was not able to access Adobe PDF files and had to re-download Adobe Reader XI

    Any body else having the same problem?

    And help get the update of Windows XP to run again?

    It would not be the first step to disable automatic updates in Control Panel and manually download and install the most recent cumulative security update for internet explorer since without first, everything in the way of troubleshooting will be futile?

    Download and install the latest cumulative security for IE8 update and manually restart the computer.

    visit windows update via the shortened link in your Start menu.

    Assuming that you have Win XP SP3 and IE8, it will be the necessary file

    http://download.Microsoft.com/download/1/9/A/19A6AC47-9EA0-455F-B918-A44D25B5304C/IE8-WindowsXP-KB2898785-x86-enu.exe

  • Cannot update Windows XP Pro after the reinstallation of the Message, the website has encountered a problem and cannot display the page you are trying to view. There is no error code displayed

    Cannot update Windows XP Pro after the reinstallation of the Message, the website has encountered a problem and cannot display the page you are trying to view. The error number is 0x8024400A.

    Should I turn off my Anti virus software is what could be stopping my updates? some sites would sugest that I use Kaspersky 2012, if that's the case, then why do all my other programs that are installed to date OK?

    Hello

    Check your level of service current pack...

    • Hold down the Windows (between Ctrl and Alt) key and press Pause break
    • Examine what is listed in the system: section

    If there is no service pack designated first level you must download SP2 from...

    http://www.Microsoft.com/download/en/details.aspx?displaylang=en&ID=28

    .. .and then run the downloaded program to install SP2.

    Once you have done this, or if you were already in service pack 1, 1a or 2, then install SP3 by downloading and running from...

    http://www.Microsoft.com/download/en/details.aspx?displaylang=en&ID=24

    For both of the above, you can ignore the text that says it's for network installations and also ignore the text advising windows/microsoft update if a single update of a PC.

    So try and get up-to-date with the Windows updates.

    Tricky

  • JavaScript: box always invalid after the page

    Hello

    In a region, I have a check box that must be disabled by default. After clicking on a button that applies a MRU/present (and verification of certain conditions) the box should switch to on.

    What I did:
    -The Javascript of the enableCheckbox() and disableCheckbox() functions are defined in the HTML page header (they work).
    -In the foot of the region with the box I call the function disableCheckbox ('myCheckbox'); to get the default value.
    -The optional URL redirection of the button says:
    JavaScript:doSubmit('SUBMIT'); to submit
    JavaScript:enableCheckbox('myCheckbox'); to activate the checkbox

    The problem is that the box will switch on, because submit/reload the page to disable the checkbox through the foot of the region. Think of other solutions, I realized that each top up will set the default again...

    How can that be resolved?
    Thanks in advance,

    Roger

    Hi Roger,

    You must have somewhere a logic that determines if the checkbox should be disabled/enabled.

    Generally speaking, it would be the value of one or more fields and the box should be checked whenever the field related (s) is / are updated using the onchange event.

    There are several ways to check for this, but the principles would be the same. For example:

    function check()
    {
     var x = document.getElementById("P1_PAGEITEM");
     var c = document.getElementById("P1_CHECKBOX");
     if (x.value == 'XXX')
     {
      c.disabled = false;
     }
     else
     {
      c.disabled = true;
     }
    }
    

    This function can be used on the page loading - by adding a call to it in Footer region region - and the attributes of the P1_PAGEITEM using:

    onchange="javascript:check();"
    

    Andy

  • Cannot upgrade to SP3 after a fresh install of XP. Gets the error while accessing the Windows Update page: "the site has encountered a problem and cannot display the page you are trying view."

    Original title: install SP3

    I did a clean install of xp with sp2, hear automatic updates.  After 3 days sp3 has not downloaded, computer at the time of the update. Cannot load an update site download also constantly message "the website has encountered a problem and cannot display the page you are trying to view.  I tried options suggest they also get the same message or fail to load.

    I did a clean install of xp with sp2, hear automatic updates.  After 3 days sp3 has not downloaded, computer at the time of the update. Cannot load an update site download also constantly message "the website has encountered a problem and cannot display the page you are trying to view.  I tried options suggest they also get the same message or fail to load.

    Just install Windows XP SP3 manually...

    Before do you - make sure you have restored all the way back to Internet Explorer 6 * and * all your drivers for hardware devices are the latest version of each of the web pages by the hardware manufacturer (Microsoft did not your hardware - to be of course checked manually for the most recent driver by visiting the Web pages or the manufacturers yourself and find the latest driver for any model device (s) you have - map) motherboard chipset video, audio, network, etc.)

    Get SP3 (manually) and save it to your desktop. (There's a link here.) [You are a COMPUTER professional for now.]

    Install it.

    Then restart at least a couple of times for a few minutes between each restart.

    Download at least Internet Explorer 7 (if it is not Internet Explorer 8).

    Install it.

    Reset.

    Now, try to get the updates through the normal web page (http://windowsupdate.microsoft.com/) and see how much more you can get (100 +) and keep checking until you no longer have.

    Back - let everyone know if it worked for you.

  • The website has encountered a problem and cannot display the page while you try to run Windows update and get error code 0 x 80240036

    I can't update, repeat me the website has encountered a problem and cannot display the page. I need to update to Windows XP Service Pack 3. The error code is 0 x 80240036

    Original title: does not refresh

    Hello

    1 did you changes to the computer before the show?

    2. who is the antivirus installed on the computer program?

    Method 1:

    I suggest you run the FIXIT from the link below and.

    The problem with Microsoft Windows Update is not working:

    http://support.Microsoft.com/mats/windows_update/

    Method 2:

    Perform the steps described in the article:

    You receive an error message "Windows Update has encountered an error and cannot display the requested page" when you try to install an update

    http://support.Microsoft.com/kb/883614

    Method 3:

    If the problem is not resolved, I suggest you try the procedure described in the link mentioned below.

    You cannot install some programs or updates

    http://support.Microsoft.com/kb/822798

    Warning: Important this section, method, or task contains steps that tell you how to modify the registry. However, serious problems can occur if you modify the registry incorrectly. Therefore, make sure that you proceed with caution. For added protection, back up the registry before you edit it. Then you can restore the registry if a problem occurs. For more information about how to back up and restore the registry, click on the number below to view the article in the Microsoft Knowledge Base:

    How to back up and restore the registry in Windows

    322756 (http://support.microsoft.com/kb/322756/( )

    I hope this helps.

  • "The website has encountered a problem and cannot display the page you are trying to see." error when I try to run windows update

    I am re - install XP on an SSD. The installation went well, but when I try to run windows update, I get the following error message: "the site has encountered a problem and cannot display the page you are trying to view. I reformatted the drive and re-installed windows many links - no luck, I get the same error message. Old disk HARD charge with the SME XP install updates to drive very well. Help please!

    See if the article sheds some light for this problem: http://support.microsoft.com/kb/836941

  • Error "the site has encountered a problem and cannot disply the page you are trying to view" when I run Windows Update

    Original title:

    I just reinstalled xp pro on my Dell D620 and it is not allowing me to run the updates. Error message: the site has encountered a problem and cannot disply the page you are trying to view. I have service pak 2

    Hello

    You get this error when you try to open the windows update or when you check for windows update?

    Check out the following link.

    You receive an error message "Windows Update has encountered an error and cannot display the requested page" when you try to install an update

    http://support.Microsoft.com/kb/883614

  • Whenever I connect to Facebook my computer starts freezing, running slow and window pops up saying there is a script running on the page.

    Original title: another scrpt running on the page

    whenever I log in Facebook my computer began to freeze and sometimes throws me completely. If not, it runs very slowly and window pops up saying that a script is running on the page which is the origin of the page to run slowly and can freeze your computer, press Yes to continue.how can I get rid of this

    Hi Eva,

    1. what web browser do you use?

    2. What if the problem occurs with all the site or it confined to Facebook?

    3. did you of recent changes on the system?

    Method 1:

    If you use Internet Explorer, you can view the following items and check if it helps.

    How to resolve script errors in Internet Explorer on Windows computers

    Error message: "a script on this page slows down Internet Explorer runs slowly.

    Method 2:

    You can also try the steps in the following link and check if this solves the problem.

    How to optimize Internet explorer?

    Hope this information is useful.

  • Buy adobe photoshop and illustrator on the page but I need to reset my mac, mac reset after that I can re - download the software by which already pay?

    Buy adobe photoshop and illustrator on the page but I need to reset my mac, mac reset after that I can re - download the software by which already pay?

    If you are able you must disconnect using the program manager of clouds before resetting.  You will be able to download again after the rest if you want.

    Cloud creation help / Creative Cloud to desktop

    https://helpx.Adobe.com/creative-cloud/help/creative-cloud-desktop.html

    Cloud creation help / sign out, sign in | Creative office cloud app

    http://helpx.Adobe.com/creative-cloud/KB/sign-in-out-creative-cloud-desktop-app.html

    Cloud creation help / install, update or uninstall applications

    http://helpx.Adobe.com/creative-cloud/help/install-apps.html

    Install creative Cloud applications

    http://TV.Adobe.com/watch/CS6-creative-cloud-feature-tour-for-video/installing-desktop-app s-of-creative-cloud.

Maybe you are looking for

  • Problem adding selection of clamp for editing in iMovie

    Using iMovie 10.2.1. When I mark a selection of a clip (by dragging the yellow selection box or scoring in an 'I' and 'o') and click on the '+' to add only 0.1 seconds of the clip to the timeline (or the shortcut 'E'), is added and not the entire sel

  • Why don't the button install clarification or work when I try to change my policy. It is a windows font

    Try to change a font Windows to Gabriola instructions say to click with the right button on the icon and then click on install but there is just no installation in the choice, it is an icon install at the top of the page but it will not lighten or re

  • Increase the size of the Partition

    I am trying to increase the size of the partition of my C drive. About 12 months ago someone partitioned my C drive, but the C drive is full and needs to be increased in size. I deleted drive D and it is shown as being unallocated. I'm in Diskpart in

  • Replacing the screen for HP Pavilion dm4 2102e0

    Hello. A screen 14 '' from a HP PAVILION DM4-2165DX 14.0 WXGA HD worthy fits into my 2102e0 DM4? Because my broken screen, and I want to buy a new screen to replace the former screen. The screen I think to buy: http://www.ebay.com/itm/LAPTOP-LCD-SCRE

  • multimedia vs samsung & sd card readers

    could not synchronize my SAMSUNG GALAXY S with media player because it is not registered when I plugged on the USB portsss (I have tried all ports). removed the sd card in the phone to try it this way. SD inserted in the slot available on computer. M