Call applet method with arguments from JavaScript

I have an applet with a method doSomething(int a, String b, double c), I want get a,b,c from threee text fields put into an HTML page, and pass them to the applet method. I've a very poor knowledge in JavaScript, how can I pass correctly the arguments without raise a CastException? It seems to me that JavaScript doesn't have int, String, double.....

Hi!
You can verify before you send the parameters to the applet
Something like that:
var result = parseInt (a);
if (result =NaN)
alert("Sorry not Int");
return false;
and after that you can send the parammeters to the applet that way:
document.yourApplet.Your_function_from_applet(result,..)
hope this help!
adina

Similar Messages

  • How to call java function with parameter from javascript in adf mobile?

    how to call java function with parameter from javascript in adf mobile?

    The ADF Mobile Container Utilities API may be used from JavaScript or Java.
    Application Container APIs - 11g Release 2 (11.1.2.4.0)

  • Call applet method with javascript

    my html - code:
    <APPLET NAME="Mail" ... ... ></APPLET>
    <form action="javascript:document.applets("Mail").test("Execute JAVA Applet Function")">
    <input type="submit" value="Execute Applet Function">
    </form>
    my applet code:
    public void test(String t)
    {System.out.println("executing test()");
    teststr = t;
    repaint();
    in the paint() method i draw the teststr with Graphics.drawString - but nothing happens...
    any suggestions?
    thx

    Directly calling a Java Applet's public method from within
    JavaScript is made possible by LiveConnect which is not implemented by Internet Explorer as of yet. LiveConnect is only available on Netscape navigator at this time.

  • Call applet methods from Javascript

    Hello,
    If I call applet method like :
    function callbackFunc(){
        var pp = appletID.getData();
        alert(pp);
    It works only if applet is deployed with <APPLET> tag or with javascript.
    If applet is deployed using <Object> and <embed> tags, in browser console the error is :
    TypeError: appletID.getData is not a function
    I couldn't find why is that behaviour. What do I do wrong?
    Thanks

    Hi Paul,
    (1)Seems to be your Java Runtime Environment path is still setted for JRE 1.3.0_01 and not for 1.3.1. So pelase go to the
    Control Panel-->java plugin 1.3.1-->Advanced. Here you set the Java Runtime Environment to the JRE 1.3.1 version. Its better to remove the older version before installing the new version on JRE.
    (2)<OBJECT> tag won't work for Netscape. You can only use <APPLET> or <EMBED> tag for Netscape.
    Hope this will help you.
    Anil
    Developer Technical Support
    Sun Microsystems
    http://www.sun.com/developers/support

  • How to call a AM method with parameters from Managed Bean?

    Hi Everyone,
    I have a situation where I need to call AM method (setDefaultSubInv) from Managed bean, under Value change Listner method. Here is what I am doing, I have added AM method on to the page bindings, then in bean calling this
    Class[] paramTypes = { };
    Object[] params = { } ;
    invokeEL("#{bindings.setDefaultSubInv.execute}", paramTypes, params);
    This works and able to call this method if there are no parameters. Say I have to pass a parameter to AM method setDefaultSubInv(String a), i tried calling this from the bean but throws an error
    String aVal = "test";
    Class[] paramTypes = {String.class };
    Object[] params = {aVal } ;
    invokeEL("#{bindings.setDefaultSubInv.execute}", paramTypes, params);
    I am not sure this is the right way to call the method with parameters. Can anyone tell how to call a AM method with parameters from Manage bean
    Thanks,
    San.

    Simply do the following
    1- Make your Method in Client Interface.
    2- Add it to Page Def.
    3- Customize your Script Like the below one to Achieve your goal.
    BindingContainer bindings = getBindings();
    OperationBinding operationBinding = bindings.getOperationBinding("GetUserRoles");
    operationBinding.getParamsMap().put("username", "oracle");
    operationBinding.getParamsMap().put("role", "F1211");
    operationBinding.getParamsMap().put("Connection", "JDBC");
    Object result = operationBinding.execute();
    if (!operationBinding.getErrors().isEmpty()) {
    return null;
    return null;
    i hope it help you
    thanks

  • How to invoke a method in JApplet from javascript.

    We want to invoke a method in JApplet from javascript.
    with the help Java Plug-in HTML Converter Version 1.3, we have generated OBJECT/EMBED tag for
    the following applet tag.
    <APPLET CODE = "SimpleApplet" WIDTH = 200 HEIGHT = 300 NAME = "simpleApplet"
    MAYSCRIPT = true>
    <PARAM NAME = "p1" VALUE = "v1">
    </APPLET>
    it is given the following code
    <!--"CONVERTED_APPLET"-->
    <!-- CONVERTER VERSION 1.3 -->
    <OBJECT classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
    WIDTH = 200 HEIGHT = 300 NAME = "simpleApplet"
    codebase="http://java.sun.com/products/plugin/1.3/jinstall-13-win32.cab#Version=1,3,0,0">
    <PARAM NAME = CODE VALUE = "SimpleApplet" >
    <PARAM NAME = NAME VALUE = "simpleApplet" >
    <PARAM NAME = MAYSCRIPT VALUE = true >
    <PARAM NAME="type" VALUE="application/x-java-applet;version=1.3">
    <PARAM NAME="scriptable" VALUE="false">
    <PARAM NAME = "p1" VALUE = "v1">
    <COMMENT>
    <EMBED type="application/x-java-applet;version=1.3" CODE = "SimpleApplet" NAME =
    "simpleApplet" WIDTH = 200 HEIGHT = 300 MAYSCRIPT = true p1 = "v1" scriptable=false
    pluginspage="http://java.sun.com/products/plugin/1.3/plugin-install.html"><NOEMBED></COMMENT>
    </NOEMBED></EMBED>
    </OBJECT>
    <!--
    <APPLET CODE = "SimpleApplet" WIDTH = 200 HEIGHT = 300 NAME = "simpleApplet"
    MAYSCRIPT = true>
    <PARAM NAME = "p1" VALUE = "v1">
    </APPLET>
    -->
    <!--"END_CONVERTED_APPLET"-->
    But, even after trying to invoke method in the JApplet from javascript, it is not being invoked in
    Netscape. it is being invoked from
    IE after changing the scriptable = true. Is there any such parameter to change, to invoke the
    method in JApplet from javascript?
    can anybody give any suggestion?

    hi there,,
    well the same problem exists with my code also, NS fails to call the function from java applet... if u get the answer please mail me on [email protected]

  • Calling a method with parameters in jstl?

    i need to call a method with a series of String parameters what am i doing wrong?
    the java
        public ArrayList getEmployeeSkills(String ename, String snmae, String yearsexp)the jstl
        <jsp:useBean id="empskill" class="com.Database.EmployeeSkill"/>
        <c:forEach var="emp" items="${empskill.EmployeeSkills(null, null, null)}">
        </c:forEach>

    this works:
         <jsp:useBean id="empskill" class="com.Database.EmployeeSkill" scope="page">
             <jsp:setProperty name="empskill" property="ename" value="Helen Smith"/>
             <jsp:setProperty name="empskill" property="sname" value="Java"/>
         </jsp:useBean>but this part isnt:
         <c:forEach var="empskill" items="${empskill.EmployeeSkillsReport}">
         </c:forEach>ive removed the get part from the method as i have done before from the java class it is calling:
    public ArrayList getEmployeeSkillsReport()
    but it produces:
    org.apache.jasper.JasperException: Exception in JSP: /main.jsp:146
    143:      </jsp:useBean>
    144:      
    145:
    146:      <c:forEach var="empskill" items="${empskill.EmployeeSkillsReport}">
    147:      </c:forEach>
    148:                          
    149:    
    Stacktrace:
         org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:506)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    root cause
    javax.servlet.ServletException: An error occurred while evaluating custom action attribute "items" with value "${empskill.EmployeeSkillsReport}": Unable to find a value for "EmployeeSkillsReport" in object of class "com.Database.EmployeeSkill" using operator "." (null)
         org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:843)
         org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:776)
         org.apache.jsp.main_jsp._jspService(main_jsp.java:244)
         org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:334)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    root cause
    javax.servlet.jsp.JspException: An error occurred while evaluating custom action attribute "items" with value "${empskill.EmployeeSkillsReport}": Unable to find a value for "EmployeeSkillsReport" in object of class "com.Database.EmployeeSkill" using operator "." (null)
         org.apache.taglibs.standard.lang.jstl.Evaluator.evaluate(Evaluator.java:109)
         org.apache.taglibs.standard.lang.jstl.Evaluator.evaluate(Evaluator.java:129)
         org.apache.taglibs.standard.lang.support.ExpressionEvaluatorManager.evaluate(ExpressionEvaluatorManager.java:75)
         org.apache.taglibs.standard.tag.el.core.ForEachTag.evaluateExpressions(ForEachTag.java:155)
         org.apache.taglibs.standard.tag.el.core.ForEachTag.doStartTag(ForEachTag.java:66)
         org.apache.jsp.main_jsp._jspx_meth_c_forEach_3(main_jsp.java:590)
         org.apache.jsp.main_jsp._jspService(main_jsp.java:232)
         org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:334)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

  • Calling a method with a string

    Here's the question:
    I want to call a method with the name equal to a string variable.
    For example, if the string variable contains "hellojava" , i'd like the hellojava() method to be called..
    if the string contains "error", the error() method should be called..
    and so on..:)

    Here is an example I had thrown together for this
    purpose of the exact demonstration, Ar'nt you in luck.:-). If there is anything you don't understand,
    I can be reached at [email protected] and will be happy to help....
    import java.lang.reflect.*;
    import java.io.*;
    class Test {
         String name = "Default";
            public Test(String name) {
                    this.name = name;
            public void test() {
                    System.out.println("Hello");
         public void count() {
              for(int i=0; i<10; i++) {
                   System.out.println(i);
           public static void main(String[] args) {
                 try {
                         Test myObject = new Test("test1");
                             Class myClass = myObject.getClass();
                   BufferedReader bRead =
                        new BufferedReader(
                        new InputStreamReader( System.in ));
                   String bufStr = null;
                   while( (bufStr = bRead.readLine()) != "exit") {
                         Method noParams = myClass.getDeclaredMethod(bufStr, new Class[] {});
                              noParams.invoke(myObject, new Object[] {});
                }catch(Exception e) {
                   System.out.println("No Such Method.");
    }Good Luck,
    -- Ian

  • Call Applet method from JavaScript, tiny test program works... SOMETIMES!?

    I have an embedded Applet in a web page, and I am trying to directly call a method in that Applet from the same page, using JavaScript.
    Here is the complete Applet:
    import java.applet.Applet;
    public class Test extends Applet {
      public String test() {
        return "test() method return value";
    }Here is the complete web page:
    <HTML>
    <HEAD><TITLE>Applet Invocation test</TITLE></HEAD>
    <BODY>
    <APPLET CODE="Test" WIDTH=10 HEIGHT=10 NAME="test"></APPLET>
    <HR>
    <SCRIPT>
    document.write( "JavaScript is working<br>" );
    document.write( document.test.test() );
    </SCRIPT>
    </BODY>
    </HTML>Is there anything wrong with this? Because it works about 15% of the time, displaying an <HR>, "JavaScript is working", and then "test() method return value" on the next line.
    The other 85% of the time, it just gets to "JavaScript is working", then I get a JavaScript error "Object does not support this property or method" for the line: document.write( document.test.test() );
    Now here's another weird quirk... I can get it to work ALL the time, if I delay the execution of the Applet method. For example, if the first line after <SCRIPT> is alert( "alert" ); then the user gets a little dialog box with "alert" message in it, and when they hit OK execution continues, and the applet method call ALWAYS works. (On a side note, if I make the Applet test() method static, it NEVER works. Why is this?)
    So it seems to me, that when it is failing, it is because the Applet is not completely loaded into the browser yet. My question is, how can I get around this?? Is there a way to instruct JavaScript to wait until the Applet is finished loading before attempting to call any methods on it?
    PS I am using Windows ME and IE 6

    Thanks for the reply, I appreciate it. I have another question, if you don't mind... here is what my new test web page looks like:
    <HTML>
    <HEAD>
    <TITLE>Applet Invocation test</TITLE>
    <SCRIPT>
    function testFunc()
      document.write( document.test.test() );
    </SCRIPT>
    </HEAD>
    <BODY onLoad="testFunc()">
    <APPLET CODE="Test" WIDTH=10 HEIGHT=10 NAME="test">
    </APPLET>
    <HR>
    </BODY>
    </HTML>What happens is: the page loads, I see a 10x10 grey applet box, and a <HR>... then a split second later, onLoad is fired, and everything on the page so far is REPLACED with the output of testFunc(), so the ONLY thing on the page after this all completes is "test() method return value"
    Why is a single document.write() statement CLEARING the page before outputting? I don't understand. If calling a document.write() from an onLoad event wipes out everything on the page, this is not extremely helpful solution.

  • VBScript which is called with Arguments from Command Line

    Hi There.
    I have been tasked to create a VBScript which needs to accomplish the following:
    It needs to be called from a command line using 4 different arguments, the arguments in order as follows:
    -          Drive letter including colon
    Warning threshold in percentage
    Warning threshold in GB remaining
    Recipient email address
    I need to be able to set up a scheduled task, to run this script, but at the same time I need to be able to specify multiple drive letters as separate steps but on a single task.  The script needs to automatically run every 4 hours, starting at 06:00AM
    in the morning and running no later than 22:00 at night.
    The end results, need to then be e-mailed to the Recipient which is specified in Argument (3).
    Following is my current script, it is not complete as I am currently pulling my hair out due to having a lack of knowledge of VBScripting....  :(  The current script also loops every 10 minutes or so, and uses the incorrect way of sending the results,
    we would like to use POSTIE.EXE to send the mail as we would want to eliminate web traffic (Microsoft Schema's) in this script.
    =====================================================================================
    Const emailFrom = "default_from_email_address_comes_here"      'From email address 
    Const ExchangeServer = "ExchangeServerName_comes_here"      'Enter your Exchange server name here (FQDN)
    Const WaitTimeInMinutes = 10                   'Wait time between loops. This is will be in minutes
    Dim WshShell, objArgs, strIP, objWMIService, LogicalVolumes, strDriveLetter
    Dim objItem, strDriveName, IntCapacity, IntFree, DiskFreePct
    Dim strIgnoreFlag
    Dim strMessage, IntStatistic
    on error resume next
      strDriveLetter         = WScript.Arguments(0)   'This is the drive letter which you want to monitor on the localhost
      DiskFreePct            = WScript.Arguments(1)   'This is the threshold percentage of free space
      ThresholdGB           = WScript.Arguments(2)
      Recipient                = WScript.Arguments(3)   'This is where the e-mail needs to be sent to
    If Err.Number <> 0 Then
      msgbox "You did not supply the arguments after calling the VBS file:" & vbcrlf & "<Drive Letter, eg:  C:>"& vbcrlf & "<Warning Threshold in Percentage> "& vbcrlf &"<Warning
    Threshold in GB Remaining> "& vbcrlf &"<Recipient E-Mail Address>"
      WScript.Quit
    End If  
    Set WshNetwork = WScript.CreateObject("WScript.Network")
    WScript.Echo WshNetwork.ComputerName
    arrServerList = array(WshNetwork.ComputerName)    'This is where your localhost will be used as the query
    Do until i = 2
        'Clear the message variable
        strMessage = ""
        'Poll the array of servers
        PollServers(WshNetwork.ComputerName)
        'Email if there is a message
        if strMessage <> "" then
            EmailAlert(strMessage)
        end if
        'The script will loop for now just for testing. Uncomment the line that follows the loop logic to cancel the loop.
        WScript.Sleep(WaitTimeInMinutes*60000)
            'i = i + 1
    Loop
    Sub PollServers(arrServers)
        on error resume next
        for each Server in arrServers
            set objSvc = GetObject("winmgmts:{impersonationLevel=impersonate}//" & Server & "/root/cimv2")
            set objRet = objSvc.InstancesOf("win32_LogicalDisk")
            for each item in objRet
                if item.DriveType = 7 then
                    end if
                    if item.FreeSpace/item.size <= AlertHigh then
                        strMessage = strMessage & UCase(strPC) & "  Drive '" & item.caption & "' is low on disk space!  There are " & FormatNumber((item.FreeSpace/1024000),0)
    & " MB free" & vbCRLF
                    end if
            next
        next
        set objSvc = Nothing
        set objRet = Nothing
    End Sub
    Sub EmailAlert(Message)
        on error resume next
        Set objMessage = CreateObject("CDO.Message")
        with objMessage
            .From = emailFrom
            .To = Recipient
            .Subject = "Server " & WshNetwork.ComputerName & " is low on Disk Space" 
            .TextBody = Message
            .Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
            .Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = ExchangeServer
            .Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
            .Configuration.Fields.Update
            .Send
        end with
        Set objMessage = Nothing
    End Sub

    I've managed to get the script fully working as required.
    ================================================================
    Const emailFrom = "your_email_here"      'From email address
    Const ExchangeServer = "exchange_server_name"      'Enter your Exchange server name here (FQDN)
    Const WaitTimeInMinutes = 240                   'Wait time between loops. This is will be in minutes
    Dim WshShell, objArgs, strIP, objWMIService, LogicalVolumes, strDriveLetter
    Dim objItem, strDriveName, IntCapacity, IntFree, DiskFreePct
    Dim strIgnoreFlag
    Dim strMessage, IntStatistic
    Dim DrivePercentage
    Dim DriveSpaceRem
    Dim mbFreeSpace
    Dim intFreeSpace
    Dim UsedPercentage
    on error resume next
      strDriveLetter           = WScript.Arguments(0)   'This is the drive letter which you want to monitor on the localhost
      DiskFreePct              = WScript.Arguments(1)   'This is the threshold percentage of free space
      ThresholdGB              = WScript.Arguments(2)
      Recipient                = WScript.Arguments(3)   'This is where the e-mail needs to be sent to             
    If Err.Number <> 0 Then
      msgbox "You did not supply the arguments after calling the VBS file:" & vbcrlf & "<Drive Letter, eg:  C:>"& vbcrlf & "<Warning Threshold in Percentage> "& vbcrlf &"<Warning Threshold in GB Remaining> "&
    vbcrlf &"<Recipient E-Mail Address>"
      WScript.Quit
    End If 
    strComputer = "."
    'WScript.Echo strComputer
    Set WshNetwork = WScript.CreateObject("WScript.Network")
    'WScript.Echo WshNetwork.ComputerName
    arrServerList = array(strComputer)    'This is where your local host will be used as the query
    Do until i = 1
        'Clear the message variable
        strMessage = ""
        'Poll the array of servers
        PollServers strComputer,strDriveLetter
        'Email if there is a message
        if strMessage <> "" then
            EmailAlert(strMessage)
        end if
        'The script will loop for now just for testing. Uncomment the line that follows the loop logic to cancel the loop.
        'WScript.Sleep(WaitTimeInMinutes*60000)
            i = i + 1
    Loop
    Sub PollServers(strComputer,strDriveLetter)
        Selectstring = "Select * from Win32_LogicalDisk Where DeviceID = '" & strDriveLetter & "'"
        on error resume next
        Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
        Set colItems = objWMIService.ExecQuery(Selectstring)
        For Each objItem in colItems
     if objItem.FreeSpace/objItem.Size * 100 <= DiskFreePct or mbFreeSpace <= ThresholdGB then
         DrivePercentage = FormatNumber(objItem.FreeSpace/objItem.Size *100,0)
         DriveSpaceRem   = FormatNumber((objItem.FreeSpace/1024000),0)
         intFreeSpace    = objItem.FreeSpace
         mbFreeSpace     = intFreeSpace / 1024 / 1024 / 1024
         mbFreeSpace     = round(mbFreeSpace,0)
         intTotalSpace   = objDisk.Size
         UsedPercentage  = 100 - DrivePercentage
              strMessage      = strMessage & " "
            end if
        Next
    End Sub
    Sub EmailAlert(Message)
        on error resume next
        Set objMessage = CreateObject("CDO.Message")
     with objMessage
            .From = emailFrom
            .To = Recipient
            .Subject = "" & WshNetwork.ComputerName & ": Alert " & Now & " -> " & UCase(strDriveLetter) & " fill level = " & UsedPercentage & "%, Space Remaining = " & mbFreeSpace & "
    GB"
            .TextBody = Message
            .Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
            .Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = ExchangeServer
            .Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
            .Configuration.Fields.Update
            .Send
        end with
        Set objMessage = Nothing
    End Sub
    'WScript.Echo "done"

  • Call a method with complex data type from a DLL file

    Hi,
    I have a win32 API with a dll file, and I am trying to call some methods from it in the labview. To do this, I used the import library wizard, and everything is working as expected. The only problem which I have is with a method with complex data type as return type (a vector). According to this link, import library wizard can not import methods with complex data type.
    The name of this method is this:   const std::vector< BlackfinInterfaces::Count > Counts ()
    where Count is a structure defined as below:
    struct Count
       Count() : countTime(0) {}
       std::vector<unsigned long> countLines;
       time_t countTime;
    It seems that I should manually use the Call Library Function Node. How can I configure parameters for the above method?

    You cannot configure Call Library Function Node to call this function.  LabVIEW has no way to pass a C++ class such as vector to a DLL.

  • About calling method with arguments

    Hi,
    I have a problem about calling method using reflection. my method is like follows:
    public myMethod(Integer var1, MyObject mobj) {
    I've tried to call the method using the following code,
    Class[] parameterTypes = new Class[] {Integer.class, MyObject.class};
    Object[] arguments = new Object[] {new Integer(2), mobj};
    Method met=cl.getMethod("myMethod", parameterTypes);
    But the in the last line NoSuchMethodException is thrown.
    How can I send the reference of MyObject to myMethod()?
    Thanx
    rony

    Should work ok:
    import java.lang.reflect.InvocationTargetException;
    import java.lang.reflect.Method;
    public class Test {
         static class MyObject {}
         public static void main(String[] args) throws Exception {
              Class c = Test.class;
              Class[] parameterTypes = new Class[] {Integer.class, MyObject.class};                              
              try {
                   Object[] arguments = new Object[] {new Integer(2), new MyObject()};
                   Method met = c.getMethod("myMethod", parameterTypes);
                   met.invoke(new Test(), arguments);
              } catch (NoSuchMethodException e) {
                   System.out.println(e);
              } catch (IllegalAccessException e) {
                     System.out.println(e);
              } catch (InvocationTargetException e) {
                   System.out.println(e);
         public void myMethod(Integer var1, MyObject mobj) {
              System.out.println("myMethod");
    }

  • Problem calling applet method using IE

    I've searched through the forum and can't seem to find anything that can help me fix this. I'm trying to call an applet's method using Javascript. This is working fine under Netscape, but not IE. Everything I've read seems to indicate that I'm doing this right, but I'm getting "Object doesn't support this property or method" when I try to call the applet method from IE.
    In this example method, I'm trying to call the applet's countChars method, which should return the length of the string you pass into it. Works under Netscape 6.2, but not IE 6.0
    Here's my applet code:
    import java.lang.String;
    public class test extends java.applet.Applet {
    public static int countChars(String s) {
    return s.length();
    And my HTML
    <HTML>
    <HEAD>
    <script language="Javascript">
    function refreshApplet()
    /*     i = document.forms.myForm.TestApplet.countChars();
         document.forms.myForm.output.value=i; */
         document.forms.myForm.output.value=document.applets["TestApplet"].countChars(document.forms.myForm.input.value);
    </script>
    </HEAD>
    <BODY>
    <APPLET CODE = "test.class" WIDTH = 400 HEIGHT = 400 ALIGN = middle NAME = "TestApplet" scriptable="true">
    </APPLET>
    <br>
    <form name="myForm">
    <input type="text" name="input">
    <input type="button" value="click me" onClick="refreshApplet();">
    <hr>
    <input type="text" name="output">
    </form>
    </BODY>
    </HTML>
    Thanks in advance!
    Craig Drabik
    Sr. Programmer/Analyst
    University at Buffalo

    I have very similar problem, my applet works OK using Netscape (6.2 and 7.0), but with IE 6.0 It only works with windows XP;
    The reported error is "Object doesn't support this property or method"
    Can someone please help me to solve this problem.
    Cheers
    Horus
    This is my code:
    - I call the applet using javaScript and input the method setData with two strings.
    function graphic()
         var dataZenith;
         var dataManual;
         initVariables();
         dataZenith = graphicZENith(); //Call other Javascript functions
         dataManual = graphicManual(); //Call other Javascript functions
         document.AppletOne.setData(dataZenith,dataManual);
    I run the applet with this HTML code:
    <applet NAME="AppletOne" code="Appl.class" width="450" height="450"
    MAYSCRIPT></applet>
    //Applet code/////////////
    import java.awt.*;
    import java.awt.geom.*;
    import java.applet.*;
    import java.util.*;
    public class Appl extends Applet {
         private int [] myArray1 = new int [156];     
         private int [] myArray2 = new int [156];
         private boolean flag = false;
         // maxDataYAxesNumber es usado para dividir el eje de las Y
    public void init()
              setFont(new Font("SansSerif", Font.BOLD, 12));
              setBackground (Color.white);
              setSize(getSize());     
    // Get data and put in an array
    public void setData(String data1, String data2)
              final String DELIMITER = ",";
              final StringTokenizer theTokens1 =
                   new StringTokenizer(data1, DELIMITER);     
              final StringTokenizer theTokens2 =
                   new StringTokenizer(data2, DELIMITER);
              try
                        String dataX = data1;
                        for (int i = 0; i < 156; i++)
                        myArray1[i] = Integer.parseInt(theTokens1.nextToken().trim());
                        myArray2[i] = Integer.parseInt(theTokens2.nextToken().trim());
              catch (NumberFormatException e) {};
              flag = true; //I get the data OK
              repaint();
    public void paint (Graphics g){
    Graphics2D g2d = (Graphics2D)g;
    setData(data1, data2) ;
    if (flag == true)
                   //Call other functions to process the graphic
    else g2d.drawString(" Sorry I can get Data", 100,80);          

  • Calling applet methods in forms - Problem

    I have an applet method wich creates a modal dialogue to retrieve user pin. This method is called from a form button. When the user is finished entering PIN, and the dialogue is supposed to close, it hangs. When using a button in an applet frame, this works fine, but apparently it doesent when I use my form button. Anybody have a workaround or solution to my problem?

    i guess the problem is that you can't do anything in the applet outside the dialog if it is modal and visible.
    Propably you should not make your dialog modal and just let it set a boolean variable when it is finished and keep the rest of the applet waiting for an answer with domething like:
    while(dialogstillopen)
    boolean dummy=false;

  • Calling a method in Class from webdynpro

    Hi All,
    I have to perform some action when i click the button created in my webdynpro screen.
    However I must not write the code for the button action inside the button event. But I have to create a class and inside the class i have to create the method for this button event.
    Can anyone tell me how to call a method in a class created in SE24 from webdynpro on clicking the button.
    Thanks in advance.

    hi..
    When you want to perform some action after clicking a Button, then you have to write the code only in 'Events' - 'On Action' event. From your question, i assume that, you wanna use Assistance class in your webdynpro so as to increase better performance. Here is the link which will guide yuo with screen shot for using assistance class in WD-ABAP.
    http://wiki.sdn.sap.com/wiki/display/WDABAP/AssistanceclassfunctionalityinWDA
    thanks,
    Padma

Maybe you are looking for