Can i cal a javascript function from a jsp without occurance of any event??

Hi,
Below is the problem that i am facing:
Problem:
I want to open a new url from a java class.
I have a java class. I am calling a jsp from this java class. JSP does some validations and after these validations, opens a url in new window. But I want to append some runtime parameters in the url and pass it through post method in jsp so that end user cannot see these parameters. Can any one tell me how to code for this schenario?
Class A calls X.jsp
X.jsp
1. do some validations
2. call some javascript function
3. append the parameters in the url using dopost method
One more thing to mention, when calling this jsp, i need to show this jsp to user, therefore there would not be any event in this jsp. I need soluions for following points:
1. Without occurance of any event, my javascript function must be called
2. desired parameters must be appended in the url
3. New url should be opened and the parameters should not be visible to end user.(ie parameters need to be passed via post method in jsp)
Appreciate your help.
Thanks,
Rajeev

You are all mixed up. Here's how it works: a JSP is a program that executes on your server. It generates HTML (which may include Javascript) and sends that to the client, most likely a browser. When it has finished generating and sending all that HTML, the browser accepts it and renders it. The browser may execute Javascript as it renders the HTML, or it may execute Javascript later upon a click or mouse action or whatever.
So your idea that the JSP will execute some Javascript is a non-starter. And that business about the JSP appending parameters and using the POST method is all backwards, unless perhaps you meant that the JSP would generate HTML containing a form that does that.
Anyway you need to clarify your thought based on how things actually work. Confounding the two phases (generating HTML on the server, rendering it on the client) will make it very difficult for you to get anywhere.

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.

  • Help needed in calling a javascript function from a jsp

    Hey guys,
    I need help.
    In my jsp I have a field called date. When i get date field from the database, it is a concatination of date and time field, so I wrote a small javascript function to strip just the date part from this date and time value.
    The javascript function is
    function formatDate(fieldName)
              var timer=fieldName;
              timer = timer.substring(5,7)+"/"+timer.substring(8,10)+"/"+timer.substring(0,4);
              return timer;
    Now I want to call this javascript function from the input tag in jsp where I am displaying the value of date. Check below
    This is one way I tried to do:
    <input size="13" name="startDate" maxLength="255" value=<script>formatDate("<%=startDate%>")</script> onChange="checkDate(this)">
    I even tried this:
    <input size="13" name="startDate" maxLength="255" value="'formatDate(<%=startDate%>)'" onChange="checkDate(this)">
    But it dosen't work
    Please help. I am struggling on this for days.
    Thanks,
    Ruby

    Hey all you developers out there , Pleaseeee help me with this one.

  • Can we call a javascript function from backing bean class?

    I have a requirement. In a multiselect table, when users selects some rows and clicks a button. Depending upon some condition, an alert box should appear with 2 buttons 'Yes' and 'No'. On clicking yes, certain field values in the selected rows of table should change. On clicking no, the alert box should close. As far as i know alert box can be done only in JS.
    Please help me, if a javascript function can be called in backing bean method or suggest some way where alert boxes can appear through ADF.

    I need to go back to the backing bean as i need to iterate through each selected row of the table in a method( method written for command button) and then if atleast one of the selected rows has job field='Manager', then an alert box needs to be displayed. If none of the rows have job field as 'manager', alert box should not be displayed.
    If I write the function for onclick, i cannot iterate through the selected rows of the table in JS function.
    Please suggest a way to do this.

  • Calling Javascript function from PL/SQL Process

    I am new to APEX and Javascript so please forgive my question.
    I have a process on page which successfully runs a few procedures etc. but now, as part of this process, I want to call a javascript function I have typed into the HTML Header.
    My question is how can I call the javascript function from my process? Is it possible?
    Many thanks
    Winnie
    ps. as an example my javascript looks like:
    <script language="JavaScript">
    function test(){
    var decision = confirm("Click a button below and watch what pops up next.");
    alert(decision);
    </script>

    See: How to call a javascript function from pl/sql?

  • ADF Question: call javascript function from backing bean?

    Hi all,
    I am running JDeveloper 10.1.3.3 with ADF BC.
    Heres my situation:
    I have a table, and after inserting a new row, then committing, I want to call a javascript function. I tried using the onkeyup javascript to force a click of the save button, and then call my function after that. However, I really only want the second function to be called AFTER the commit has occurred.
    I have tried putting a setTimeout on the second function, but this never executes then. Is there some way that I can call the second javascript function from the backing bean? Is there a better workaround for this? Here is some code:
            function submitCreate(e) {
                var _event = (window.event) ? event : e;
                var KeyID = _event.keyCode;
                switch (KeyID)
                    case 13:
                        document.getElementById("form1:tvoTable:commitButton").onclick();
                        doAjax();
                        break;
            function doAjax() {
                var item = document.getElementById("form1:inputText3").innerHTML;
                getAjax(item, "FULL");
            }Thanks,
    Heather

    Maybe try adding an af:script block in your jsp as a partial target in your backing bean when you commit to the database? We are doing something similar when we get a tab DisclosureEvent but the principle should be the same.
    In our jsp we have:
    <af:script id="scriptID" text="alert('javascript here');"/>
    In the backing bean we have:
    method(DisclosureEvent de) {
    // get a component somehow or the component, we get it from the disclosure event
    // but you could use a binding also. if you don't have the exact script element you need
    // to find it like we do below.
    UIComponent c = de.getComponent();
    // Find our real script component
    UIComponent target = c.findComponent(":scriptID");
    // get the adf context
    AdfFacesContext adfContext = AdfFacesContext.getCurrentInstance();
    // add the script as a partial target.
    if(target != null) {
    adfContext.addPartialTarget(target);
    This relies on PPR though, which you may not be doing. If you are navigating to a new page you could set an indication in a backing bean and then access that in an <af:script> block in the new page or even generate the Javascript you want depending on your logic and access all of it via an EL binding on the af:script tag:
    <af:script id="scriptID" text="#{bbean.generatedScript}"/>
    Hope this helps!
    Steve

  • How can I access JSP variables from a JavaScript function in a JSP page?

    Respected sir
    How can I access JSP variables from a JavaScript function in a JSP page?
    Thanx

    You may be get some help from the code below.
    <%
        String str="str";
    %>
    <script>
        function accessVar(){
           var varStr='<%=str%>';
           alert(varStr);// here will diplay 'str'
    </script>

  • How to call javascript function from PL/SQL procedure

    Can anybody advice me how to call javascript function from PL/SQL procedure in APEX?

    Hi,
    I have a requirement to call Javascript function inside a After Submit Process.
    clear requirement below:
    1. User selects set of check boxes [ say user want to save 10 files and ticks 10 checkboxes]
    2. user clicks on "save files" button
    3. Inside a After submit process, in a loop, i want to call a javascript function for each of the file user want to save with the filename as a parameter.
    Hope this clarify U.
    Krishna.

  • Calling javascript functions from xsl on mac safari

    Hi,
    I am having a problem calling external javascript functions from xsl on mac safari, i am trying to generate a dropdown dynamically from an xsl document using XSLTProcessor through javascript, following is the code snippet of the xsl document
    <select name="ddl_EmailSubType" class="Menu" onclick="onEmailSubTypeChange();" id="ddl_EmailSubType" >
    <xsl:for-each select="./SubTypeFields/FieldGroup">
    <xsl:if test="@SubTypeGroup != 'All'">
    <option>
    <xsl:attribute name="value">
    <xsl:value-of select="@SubTypeGroup"/>
    </xsl:attribute>
    <xsl:if test="@SubTypeGroup = $SelectedSubContentType">
    <xsl:attribute name="selected">selected</xsl:attribute>
    </xsl:if>
    <xsl:value-of select="@SubTypeGroup"/>
    </option>
    </xsl:if>
    </xsl:for-each>
    </select>
    here the function onEmailSubTypeChange() is present in an external js file, all the other functions from this files are executed successfully except the ones which are defined in the xsl document.
    I have also tried replacing onclick="onEmailSubTypeChange();" with onclick="javascript:alert('hello world');" but the event is not getting fired at all since i cannot see any alert on the selected item change of the dropdown.
    Is there a way in which i can achieve this ?
    any helps appreciated.
    Thanks in advance
    Vikas Mestry.

    Hi,
    you can use this example VI
    Regards,
    Aurélien J.
    National Instruments France
    #adMrkt{text-align: center;font-size:11px; font-weight: bold;} #adMrkt a {text-decoration: none;} #adMrkt a:hover{font-size: 9px;} #adMrkt a span{display: none;} #adMrkt a:hover span{display: block;}
    >> Du 30 juin au 25 août, embarquez pour 2 mois de vidéo-t'chat ! Prenez place pour un voyage au coe...
    Attachments:
    browser gps.vi ‏23 KB

  • Calling a JavaScript function from an JApplet...

    Can anyone help? Is it possible to call a JavaScript function from within a JApplet? If so, what is the syntax? I've seen reference to the Netscape package but I've been led to believe it doesn't always work within Internet Explorer 6 which is the target browser.
    If the above is not possible can anyone tell me if and how it is possible to load images from outside the init() method of a JApplet? This would allow me to work around the problem.
    Thanks in advance - Jim.

    Call javascript you use the JSObject
    Please note the MAYSCRIPT int the html file.
    html file:
         <object classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
                  height="0" width="0" >
            <param name="code" value="someApplet.class" />
            <!--[if !IE]> Mozilla/Netscape and its brethren -->
            <object classid="java:someApplet.class"
                    height="0" width="0"
                    mayscript=true>
            </object>
            <!-- <![endif]-->
          </object>
    <LABEL id="lblOutputText">This text is the HTML text </LABEL>java class:
    // new class for jsObject!!!! compile this: javac -classpath "C:\Program Files\Java\jre1.5.0\lib\plugin.jar" someApplet.java
    // since jaws.jar does not exsist anymore
    // in 1.4.0 to compile: javac -classpath "C:\j2sdk1.4.0_03\jre\lib\jaws.jar" someApplet.java
    // for msjvm use the -source 1.3 -target 1.1 option so the command looks like this:
    // javac -source 1.3 -target 1.1 -classpath "C:\j2sdk1.4.0_03\jre\lib\jaws.jar" someApplet.java
    import netscape.javascript.*;
    public class someApplet extends java.applet.Applet {
        JSObject win;
        public void init() {
             try{
                 win = JSObject.getWindow(this);
    // you need win.eval("window.close();"); // to close the window. if the current window is not a popup
    // opened by a parent with window.open than the user will get a waring, your next question probably will
    // be "can I stop this warning" and the answer is simple: NO
                 JSObject textBoxLabel = (JSObject) win.eval("document.getElementById('lblOutputText')");
                 textBoxLabel.setMember("innerHTML", "<center><h1>Some text</h1></center>");
            }catch(Exception e){
                 e.printStackTrace();
    }

  • Is it possible to call a JavaScript function from a dialog?

    Hi there,
    At the moment I have created a dialog, that consists of three text fields that a user fills out, and then clicks next.
    What I am attempting to do, is pass the result of these three textboxes to a JavaScript function I have laying in a file in Web Resources. I've done some research, and I can't find anything.
    So my question is - is it possible to call a JavaScript function from a dialog?
    Thanks for your time.

    Hi,
         It is not possible unfortunately. We can start dialog from script but not the other way unfortunately. However, you can always write server side code for this and it will surely execute. So instead of javascript, write plug-in.
    Hope this helps.
     Minal Dahiya
     blog : http://minaldahiya.blogspot.com.au/
     If this post answers your question, please click "Mark As Answer" on the post and "Vote as Helpful"

  • Call javascript functions from PL/SQL

    Hi !
    I just want to know if it is possible to call a javascript function from a PL/SQL procedure. If yes, anybody can explain me the syntax ?
    Thanks
    Chantale

    You can call Java Script - kind of.
    PL/SQL has a "web browser" called UTL_HTTP. It allows you to make HTTP calls to a web server. This includes a function that can be used from SQL too (with a size limitation).
    Example:
    SQL> select UTL_HTTP.Request( 'http://some-web-server' ) as HTML_PAGE from dual;
    HTML_PAGE
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <META HTTP-EQUIV="Refresh" CONTENT="1;URL=http:/some-web-server:7777/index">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <img src="images/Wave.gif">
    Redirecting.. please standby..
    <hr>
    </html>
    SQL>The call to the web browser can be to execute and load, for example, a JSP page.
    However, if the page containts client-side Java script, i.e. code for the web browser to execute, than UTL_HTTP will merely return the contents & code of that page.
    Client-side Java Script requires an engine in the browser. The JS language is used to manipulate the rendering engine of the browser.
    The PL/SQL "web browser" does not have a display device to show a web page. Thus it is without a web browser rendering engine and therefore also cannot execute Java Script either.

  • Calling javascript function from applet

    Can anyone pl help me with the syntax for calling a javascript function from applet.
    Thanx.

    Try this url:
    http://www.inquiry.com/techtips/java_pro/10MinuteSolutions/callingJavaScript.asp
    It also provides some examples.

  • Calling javascript function from report customization form

    I have been unable to call any user-defined javascript function from Portal Report Customization forms.
    Even a simple Message Box function doesn't work. I've been placing my code in the ..after header PL/SQL section for the report customization form.
    htp.p('<script type="javascript">');
    htp.p('function MsgBox(message){');
    htp.p('alert(message);}');
    htp.p('</script>');
    htp.p('See if it works');
    I have verified in plain html that my syntax is fine. Even the syntax rendered by portal is correct:
    <script type="javascript">
    function MsgBox(message){
    alert(message);}
    </script>
    See if it works
    Despite this, you will get a javascript error that an Object is expected, MsgBox not defined. Clearly from the script above MsgBox is defined.
    I have tried any number of calls to user defined functions and can't get anything to work. However, calling native functions like 'alert' works fine ( ie
    See if it works
    Anyone know how I can call a user defined javascript function in a Portal Report Customization form?

    Try changing the code
    htp.p('<script type="javascript">');
    to
    htp.p('<script language="javascript">');
    Thanks
    -Krishnamurthy

  • Invoke javascript function from outside the pdf

    Hello
    Is there a possibility to invoke a (inside) PDF-JavaScript function from outside the PDF?
    Do I need the PDF SDK? Where can I get it? Where can I find examples?
    Thank you
    Sincerely
    Lore

    [email protected] wrote:
    > Hello
    >
    > Is there a possibility to invoke a (inside) PDF-JavaScript function from outside the PDF?
    >
    > Do I need RE? Do I need PDF API?
    >
    > What I want to do is collect form data by a Server script.
    >
    > Thank you
    > Sincerely
    > Lore
    I don't know of a way to invoke a javascript function from outside the PDF. Adobe LiveCycle Forms
    (Form Server) gives you the ability to extract form data from a submitted form. You should
    investigate this option.
    Justin Klei
    Cardinal Solutions Group
    www.cardinalsolutions.com

Maybe you are looking for