Can we call a javascript fun through jsp page without any event

Hi ,
I am new to jsp,javascript and i have a little question.
If i make a function in a js file and want to call it from a jsp file without any event ,ie can i write some thing like <%abc()%> in ths jsp page ,which call the function from another .js file.
I suppose that it can be done as gmail page reloads it self after some time and for http mostly we use pull ie request from the client side ,so i think that they must be doing something like timer expiry and reload themselves.
please help me with the solution.
Thanks & Regards
Saurabh

sorta....
The JS runs in the client, not on the server, so you would just be writing JS code as HTML... If your page is like this and the myscript.js file defines 2 functions (function1, function2), you can call them on page load in either of these ways. I'm not sure offhand which would get called first, but the scripts called inline in the page would be called in the order they are defined in the page. But that is all HTML, it has nothing to do with JSP.
<head>
<script language="JavaScript" type="text/javascript" src="myscript.js" />
</head>
<body onload="function1();">
<script language="JavaScript" type="text/javascript">
function2();
</script>
</body>

Similar Messages

  • How to call a Javascript function from backing bean without any event

    Hi,
    Someone knows how to call a Javascript function from backing bean without any event ?
    thanks

    Please review the following thread:
    ADF Faces call javascript
    Luis.

  • How can i call java class file in jsp page

    Hai,
    i wants to call .class file in jsp page.
    my class file is in C:\jsdk\bin.
    Thanks

    I'm not entirely sure what you mean by "calling a class file", but I'm going to assume that you want to do something like the following in your page:
    <%
    MyClass myClass = new MyClass();
    myClass.someMethod();
    %>etc
    If that's the case, then all you have to do is make sure that the class is in the servlet engine's classpath. You'll probably also need to include an appropriate import statement at the top of the page.
    Hope that helps.

  • 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.

  • How can we  use java variable in javascript code on JSP page?

    How can we use java variable in javascript code on JSP page?
    Pls help

    Think about it:
    JSP/Java is executed on the Server and produces HTML+JavaScript.
    Then that HTML+JavaScript is transfered to the client. The client now interpretes the HTML+JavaScript.
    Obviously there's no way to access a Java variable directly from JavaScript.
    What you can do, however, is write out some JavaScript that creates a JavaScript variable containing the value of your Java variable.

  • Including JavaScript into a JSP Page

    Hi,
    How do i include a piece of JavaScript <SCRIPT> stuff into a JSP Page?
    Right now i have an HTML Page that includes some <SCRIPT> code. Now many other HTML files use this piece of <SCRIPT> stuff. How do i remove it , put it in one place(I mean where to put it and what would that file be called) and in a JSP page call this <SCRIPT> code?
    Please help . i'm pretty new to JSP and JavaScript.
    Thanks in Advance.
    Phani
    /**** CODE
    <SCRIPT language=javascript>
    <!--
         if ((document.images) && ("Netscape" != navigator.appName) && (navigator.appVersion.indexOf('Mac') == -1))
         document.write("<LINK REL=\"stylesheet\" TYPE=\"text/css\" HREF=\"http://www.telia.se/tews/css/1.css\">");
         else if ((document.images) && ("Netscape" != navigator.appName) && (navigator.appVersion.indexOf('Mac') > 1))
         document.write("<LINK REL=\"stylesheet\" TYPE=\"text/css\" HREF=\"http://www.telia.se/tews/css/5.css\">");
         else if (("Netscape" == navigator.appName) && (parseInt(navigator.appVersion) == 4) && (navigator.appVersion.indexOf('Mac') == -1))
         document.write("<LINK REL=\"stylesheet\" TYPE=\"text/css\" HREF=\"http://www.telia.se/tews/css/2.css\">");
         else if (("Netscape" == navigator.appName) && (parseInt(navigator.appVersion) == 4) && (navigator.appVersion.indexOf('Mac') > 1))
         document.write("<LINK REL=\"stylesheet\" TYPE=\"text/css\" HREF=\"http://www.telia.se/tews/css/3.css\">");
         else if (("Netscape" != navigator.appName) && ("Microsoft Internet Explorer" != navigator.appName))
         document.write("<LINK REL=\"stylesheet\" TYPE=\"text/css\" HREF=\"http://www.telia.se/tews/css/6.css\">");
    // -->
    </SCRIPT>

    Ok, first let us make clear the demarcation between java and javascript.
    Java runs on the server, and produces an HTML page which is sent to the client.
    That HTML page may contain javascript code on it to run on the client side.
    As the page is loaded, javascript may be compiled/run on the client.
    So you have some javascript code which you want to include on every page as template text?
    I would do this in JSP by using the include directive to add that bit of template text to every single JSP page.
    ie
    header.jspf
    <SCRIPT language=javascript>
    <!--
    if ((document.images) && ("Netscape" != navigator.appName) && (navigator.appVersion.indexOf('Mac') == -1))
    document.write("<LINK REL=\"stylesheet\" TYPE=\"text/css\" HREF=\"http://www.telia.se/tews/css/1.css\">");
    else if ((document.images) && ("Netscape" != navigator.appName) && (navigator.appVersion.indexOf('Mac') > 1))
    document.write("<LINK REL=\"stylesheet\" TYPE=\"text/css\" HREF=\"http://www.telia.se/tews/css/5.css\">");
    else if (("Netscape" == navigator.appName) && (parseInt(navigator.appVersion) == 4) && (navigator.appVersion.indexOf('Mac') == -1))
    document.write("<LINK REL=\"stylesheet\" TYPE=\"text/css\" HREF=\"http://www.telia.se/tews/css/2.css\">");
    else if (("Netscape" == navigator.appName) && (parseInt(navigator.appVersion) == 4) && (navigator.appVersion.indexOf('Mac') > 1))
    document.write("<LINK REL=\"stylesheet\" TYPE=\"text/css\" HREF=\"http://www.telia.se/tews/css/3.css\">");
    else if (("Netscape" != navigator.appName) && ("Microsoft Internet Explorer" != navigator.appName))
    document.write("<LINK REL=\"stylesheet\" TYPE=\"text/css\" HREF=\"http://www.telia.se/tews/css/6.css\">");
    // -->
    </SCRIPT>
    <noscript>
      // stuff here for when the browser does not support javascript
    </noscript>And then in every jsp page
    <%@ page include="header.jspf" %>
    // rest of the JSP pageThe file "header.jspf" will be included with every jsp page served, and you only need to update that page in one place.
    If you have a JSP2.0 container you can define a jsp prelude which will be the same as having the <%@ page include="header.jspf" %> on every page.
    You do this in the web.xml file:
    Something like this:
      <jsp-property-group>
         <url-pattern>*.jsp</url-pattern>
         <include-prelude>/WEB-INF/jspf/prelude1.jspf</include-prelude>
      </jsp-property-group>The specified file will be loaded into every JSP page without the JSP page having to define the import itself.
    Hope this helps,
    evnafets

  • How to call the crystal report in jsp page

    dear friends
    i want to run or call the crystal report in jsp page.
    if u know that can u send sample code for that to my id
    [email protected]

    Hi Sudhakar,
    Could you please be more speicific about the task you want to accomplish?
    Cheers
    Giri :-)

  • Virus scan failed Error on deploying a web application having a jar file for calling the applet on the jsp page

    Hi,
    I have an applet application that i want to deploy on the Oracle cloud.
    So i have created a jar file for the applet application and i am using this jar to call the applet on a jsp page.
    But when i am delpoying my application on the java cloud, its giving me the below error:
    2014-10-28 03:16:41 CDT: Starting action "Virus Scan"
    2014-10-28 03:16:41 CDT: Virus Scan started
    2014-10-28 03:16:49 CDT: ----------------------------------------------------------------------
    2014-10-28 03:16:49 CDT: File Scanned: "Application7.ear".
    2014-10-28 03:16:49 CDT: File Size: "106698122".
    2014-10-28 03:16:49 CDT: File Status: "INFECTED".
    2014-10-28 03:16:49 CDT: ----------------------------------------------------------------------
    2014-10-28 03:16:49 CDT: Virus scan failed.
    2014-10-28 03:16:49 CDT: "Virus Scan" complete: status FAILED
    Can't we deploy any application having applet or swing component's onto the cloud?
    Or do we need to request for any extra permissions for the same?
    Thanks,
    Manoj

    I don't see applets mentioned in the supported features nor in the unsupported features so not sure if they are supported you would likely need to contact the operations team to confirm.
    Jani Rautiainen
    Fusion Applications Developer Relations
    https://blogs.oracle.com/fadevrel/

  • How to call a report from a jsp page

    Hi
    1) Can anyone please tell me how can i view Discoverer report from a jsp page instead of opening it directly thru plus/viewer.
    2) Please clarify do i need to install Infrastructure and OID for it.
    Please advice.
    Thanks

    You need the AS infrastructure if you want to use connections. If you do not intend using connections, you do not require the infrastructure.
    Note that you cannot pass in passwords in the URL any longer. You do not need to pass passwords if you pass in a Discoverer connection id (but then again - if you don't use connections, then you do need to still pass in the connection information - username, password, database, language, EUL)
    I have a post on my blog that describes how to pass a password using an HTML Form submit - http://oraclebi.blogspot.com/2005/08/passing-password-to-viewer.html
    Thanks
    Abhinav
    Oracle Business Intelligence Product Management
    BI on Oracle: http://www.oracle.com/bi/
    BI on OTN: http://www.oracle.com/technology/products/bi/
    Discoverer: http://www.oracle.com/technology/products/discoverer/
    BI Software: http://www.oracle.com/technology/software/products/ias/devuse.html
    Documentation: http://www.oracle.com/technology/documentation/appserver1012.html
    BI Samples: http://www.oracle.com/technology/products/bi/samples/
    Blog: http://oraclebi.blogspot.com/

  • How can i call a zreport from my bsp page.

    Hi friends,
    How can i call a zreport from my bsp page.
    Moosa

    Hi Friend,
    These are the codings  to be wirtten in BSP for transferring values to the REPORT
    DATA:wf_date TYPE ztable-ID.
          data:seltab type standard table of rsparams,
           wa_seltab like line of seltab,
         event TYPE REF TO if_htmlb_data.
    DATA:p_value TYPE REF TO CL_HTMLB_INPUTFIELD.
    event = cl_htmlb_manager=>get_event( runtime->server->request ).
    p_requ ?= CL_HTMLB_MANAGER=>GET_DATA(
                                            request  = runtime->server->request
                                            name     = 'inputField'
                                            id       = 'i1'
    if p_requ is not initial.
      wf_date = p_requ->value.
    endif.
    clear wa_seltab.
    if wf_date is not initial.
      wa_seltab-selname = 'P_REQU'.
      wa_seltab-kind = 'P'.
      wa_seltab-option = 'EQ'.
      wa_seltab-low = wf_date.
      append wa_seltab to seltab.
    endif.
    submit *ZSAMPLEAP1* with selection-table seltab AND RETURN  .(ZSAMPLEAP1 refers to the report name and AND RETURN for coming back to the BSP page after the completion of its operation in Report )
    IMPORT int_name TO int_name FROM MEMORY ID '*zid*'.(For importing the obtained value from Report)
    In Report
    REPORT  ZSAMPLEAP1.
    SELECT-OPTIONS: p_requ FOR ztable-id  NO INTERVALS.
    SELECT SINGLE name from ztable into int_name WHERE id = p_requ-low.
    WRITE:int_name.
        EXPORT int_name TO MEMORY  ID 'zsharmila'.
    With Regards,
    SHARMILA BRINDHA.M

  • Can I Use Swing Components in a JSP Page

    Hi,
    Can I use Swing Componnents in a JSP Page.If so,Can anybody provide with a sample code.
    Thanks.

    hi,
    I wanted to use the JTabbedPane for tab buttons in my
    Jsp Page.Is that possible?I am afraid that you can't.
    As for GUI (graphics) in the HTML page you can use only the html form elements (but you should simulate other behaviours by dynamically reloading the page).-
    Ionel.

  • Forward to JSP page without using Navigation Model

    How can I forward to a JSP page without using the Navigation Model?

    It's done in the cardemo example in
    ImageMapEventHandler.processAction() Is there a reason
    for it there?Ah ... that makes sense.
    That code in CarDemo was written before there was such a thing as a NavigationHandler, and we didn't have time to update it to the new approach before the EA4 release. That'll be changed before the next one. In the mean time, I'd recommend that you use the navigation rules mechanism where it works for you, because it encourages good separation of business logic and presentation logic that will lead to more maintainable applications.
    Craig

  • I have a Macbook Air 2011. Can i run Bit-locker in Windows 7 Ultimate without any problems?

    I have a Macbook Air 2011. Can i run Bit-locker in Windows 7 Ultimate without any problems?

    montana girl wrote:
    I purchased a MacBook AIr Nov. 2011 11" and current OS X 10.7.5.  I read that I needed to update to Snow Leopard before I can update to Maverick, ...
    Whatever you read was incorrect. You can upgrade directly to Mavericks. It is in the App Store and is free.
    Snow Leopard predates the operating system you already have. That's the reason it will not install on your MacBook Air. You spent $20 needlessly for it, but it's yours to resell if you wish.

  • I recently updated my iPad now I can't access all the documents in the pages app, any advice to to get them back on my iPad?

    I recently updated my iPad now I can't access all the documents in the pages app, any advice to to get them back on my iPad?

    I don't think you're on iOS 5, I think you're using iOS 6.  That's the latest version.
    Unless you've used iCloud to back up your documents, you won't be able to restore them.  And for future reference, you don't have to uninstall Pages to update your iPad anymore.  Sorry about this.

  • Can i retrieve my Original apple id and pass without any informations?

    Can i retrieve my Original apple id and pass without any informations?

    Do you at least remember what your old Apple id username is? Is it just the password you have forgotten?
    Frequently asked questions about Apple ID
    If you forgot your Apple ID password

Maybe you are looking for

  • I'm trying to submit a gas meter reading and have gotten a message that says firefox is "too modern" How do I fix this?

    I got an error message that says the web browser I have is too modern and it won't allow me to submit my gas meter reading. == This happened == Not sure how often == I signed on to my gas company website and couldn't submit my meter reading

  • Pr CS7 Feature Requests

    I am excited about getting my hands on CS6, and congratulate the Adobe team for their hard work.  However... I haven't seen anything in the web pages or videos about these features that are vital to working editors, already requested by me and many o

  • One error message by submit button on long form

    I've done this before, but I don't remember what I did. I have a very long form with some spry validation. I want to make it so when the user goes to click submit at the bottom of the form, they get ONE error message for all text field validation fai

  • CRVS2010 Beta - Help Wanted for VS2010 and CR!

    I have been having a hard time getting CR to appear in the VS2010 Ultimate toolbox. I have set the target to Framework 4.0 and installed the CR4VS2010 program but the CR viewer is not showing. The problem is worsened by the fact that I am new to CR a

  • When starting SAP client always ask about license server

    Dear Users, from few days every user who is loggin into SAP 8.8 PL16 is asking about license server address. After typing license server address everything works fine until next start of the SAP client - prompt for license server shows again and agai