Java to JavaScript ... is LiveConnect passe'?

I need to communicate for a Java Applet to some JavaScript. I see that the netscape.javascript.JSObject class and the exception 'JSException are well documented but I only found this class in an older zip file (java_30.zip from 7/10/1997). Is this still the right way to do this? ...or has LiveConnect been superceded?
Cheers,eh!

Off topic. Locking.

Similar Messages

  • Error using java and javascript

    I have a jsp page that links to a bean and is working fine (getting data from the database).
    On a html form I have a button with a picture that fires off javascript when clicked:
    <BUTTON TYPE=reset onclick=showinfo('<%=index%>')>
    <IMG SRC="http://localhost:8080/Portal/Images/q2.bmp" ALT="Info">
    </BUTTON>
    The javascript function just opens a new window and displays the text sent in:
    <Script Language=JavaScript>
    function showinfo(arrayindex)
    InfoWin=window.open("","InfoWin","width=345,height=220");
    InfoWin.document.write(arrayindex);
    return false;
    </Script>
    Well in the above example index is a number (pulled from the database using a java bean and javascript converts it into a string then the function displays it correctly. If I replace <%=index%> with regular text it works fine as well(because java isn't used to pull data)! The problem occurs when I retrieve text data from the database and send it to the function. The web page gives errors about a nonterminating string. But I can move the code to somewhere else on the form(as long as I don't send it to java script) and it will print the text to the screen. I can also view the source of the web page and the html shows the text from the data base as if I hard coded the text into the javascript!!!!!!!!!!!!!!!!!
    This must be a bug between java and javascript!
    -can pass numbers(from a database) between the two
    -can't pass text (from a database)between the two
    Any info would help!

    Found the problem myself!
    I am using an odbc connection to msaccess and the spaces in the text was messing things up!
    After taking out the spaces it worked again.

  • Java and javascript cookies

    Hi
    i create a cookie called "SaveState" from javascript in my JSP dynpage.
    I want to read this from java (NOT JAVASCRIPT).
    Is this possible?
    if not, is there some kind of portal memory I can use to pass values between java and javascript?
    thanks
    Anton Kruse

    Hi,
    <b>Domain</b>
    The "domain" parameter is used to set the domain the cookie is accessable to. A path can be set for your own domain only and the domain path must include at least two periods (.domain.com). It must match your server's domain name. Therefore cookies are not a security risk since only the server that sets them can use them.
    Check this to know more about cookies:
    http://www.comptechdoc.org/independent/web/cgi/javamanual/javacookie.html
    If you still have questions, I will suggest to google on cookies.
    Greetings,
    Praveen Gudapati

  • Java to javascript problems with '

    I have a class that pass some strings to a javascript alert(<....>)
    In this sting I have some < ' > and when I launch the class I get always an alert with the ASCII code of < ' >.
    I used this syntax inside the String
    String alertSctring="Let \' go";
    but I get
    Let &#39 go
    Why?

    I'm sure the problem has to do with escaping values in strings in Java and Javascript.
    Try using double-backslash quote.. like "Let \\' Go"

  • Java vs Javascript NOT THE SAME THING

    Since we're all just users here it might be appropriate to remind people that Java and Javascript are two distinctly different things. With the recent warnings about Java some might be inclined to also disable Javascript in their browsers. There is no need to do that.
    Even thought the two frameworks have similar names they are not related.

    drcouzelis wrote:
    grabbexi wrote:I want to understand Unix/Linux better
    Which aspect of Unix / Linux do you want to understand better?
    Options include:
    Networking
    Servers
    System administration (user accounts, permissions)
    Software development
    Package management
    Differences between distributions / operating systems
    Kernel compiling
    The Linux Standard Base (LSB)
    Shared libraries
    Version control software
    Embedded linux
    The init process, boot manager, and dual booting
    File systems
    And other stuff.
    I was thinking a basic mix of everthing above, basically. Like: What are libraries? How does the system administration work? How does the kernel work? Etc. I mean - the answers are often not so complicated to understand on a basic level. My problem is, I don't know what questions to ask.
    I think I'm looking for some "tasks" which don't require a lot of time, I don't really HAVE the need to do extremely much on my Arch - but I would love to be ABLE to do more.
    bohoomil wrote:Well, I believe you mean 'using a particular Linux distribution' in the first place.
    Yes, you are right - that is what I meant.
    General response: Thanks to all of you so far. I'm starting to understand what I should do, just hoping I'm on the right track now.

  • Java to Javascript in Mac OS

    Hi ,
    I need help . I need to communicate from applet to java script in the same page . the only thing i came across is netscape.javascript.JSObject which gives access to DOM object . but this thing does not work with MAc system . i am using power MAc with classic JVM MRJ 2.2.5 . If some body can help me on this
    Siddhu

    I dont know whether you can do the reverse communication from java to javascript or not put once method define as public can be aacessed by javascript method and define the class as public.

  • What's the difference between java and Javascript?

    I a new programer, I am getting Java down. Now I want to add some java scripts to my site. Is there any difference between java and Javascript? Can I use the Java API site refference and classes? Thanks..

    Java is a programming language, Javascript is more for web pages. It is used to add interactivity to your web pages. 2 different languages.
    check out www.java.sun.com for Sun Java stuff.
    Lynn

  • Java or Javascript?

    Wanting to send SMS text from a mobile phone to a webpage, the wepage has a scrollbar that will change everytime an SMS text message is sent. Is this going to be Java or Javascript to allow this to work ?.
    Cheers.

    Wanting to send SMS text from a mobile phone to a
    webpage, the wepage has a scrollbar that will change
    everytime an SMS text message is sent. Is this going
    to be Java or Javascript to allow this to work ?.
    Cheers.It would be a wap page for the mobile phone. You could use a jsp for that. A controller would get the info from the jsp and send it to some code using Noctor API(www.noctor.com) or something similar. Using this API you would opene an SMPP connection to an SMSc and send the message to it.
    I would suggets you try to understand the SMPP API a little bit and gothrougn one of the APIs which supports the protocol.

  • Java inside javascript

    Hi
    i am getting alert messages to be displayed in the GUI from the properties file.
    can anyone tell me how can i use java inside javascript..?
    so that i can use ResourceBundle file in javascript.
    Regards
    Sonia

    Do you know how to retrieve the text you want from the properties file? If so then all you have to do is add:
    <script type="text/javascript">
    alert('<%=variablename%>');
    </script>
    to your page, where you replace variablename with the name of the String you want alerted.
    If you don't know how to retrieve what you need from the properties file, maybe you should ask that question.

  • Use plsql within java (or javascript) programs

    hi,
    to interface with oracle db, I've always used PLSQL blocks within programs written in C language but now I've to insert PLSQL blocks in java or javascript language
    I don't know if it's possibile and I don't know how to do it
    may someone explicate it to me?
    thanks a lot!

    mfran2002 wrote:
    hi,
    to interface with oracle db, I've always used PLSQL blocks within programs written in C language but now I've to insert PLSQL blocks in java or javascript language
    I don't know if it's possibile and I don't know how to do it
    may someone explicate it to me?
    thanks a lot!There is no pre-processor in the Java standard packages (don't know if there is one out there somewhere, but I imagine that there probably is) as there is for Pro*C. Oracle have one in store??? ... hope so.
    So in Java the SQL (including function calls) is built as Strings, which are then fed as arguments to the execute methods of Statement, or to the PreparedStatement itself - that tutorial will spell this all out well.
    So the SQLs can be static or build dynamically.
    ~Bill
    Also ... you can store Java stored procedures in the Oracle DB, wrapped as PL/SQL functions and then call them as such.

  • Passing a String from Java to Javascript

    Does anybody know how to pass a string from Java class to Javascript ? Can it be done?

    If you are talking in terms of web terminology...
    People do intialization of page in the following way.
    var java_script_variable = <%=String_variable%>

  • 1.6.0_10 and 11, Memory leak returning variables from Java to JavaScript

    Environment: Windows XP SP2, IE7, JScript 5.7, JRE 1.6.0_11-b03 and 1.6.0_10
    Memory allocated in Java and returned as a JavaScript variable value is not garbage collected in Java when the JavaScript variable is re-used.
    In the following simplified example, a populated HashMap is returned from the applet test1 method to the JavaScript variable hash1.
    The JavaScript variable hash1 is re-used on the next iteration so I would expect it should be marked for garbage collection.
    In 1.6.0_7 and previous releases, the memory associated with this Java HashMap is freed implicitly.
    In 1.6.0_10 and 1.6.0_11 the HashMap memory is never freed.
    Is this is what we should expect, a feature of the significant LiveConnect changes that were part of 1.6.0_10?
    Do we need to rewrite our code to call new Java methods from JavaScript explicitly freeing the memory, in this example calling the freeMem method?
    Has anybody else experienced this problem since 1.6.0_10?
    Thanks
    Rob
    Example code ...
    TestRLApplet.java
    import java.applet.Applet;
    import java.util.HashMap;
    public class TestRLApplet extends Applet
    private HashMap hash1;
    public TestRLApplet()
    public void init()
    public HashMap test1()
    hash1 = new HashMap();
    for (int i = 0; i <10; i++) {
    hash1.put(Integer.toString(i),Integer.toString(i));
    return (hash1);
    public void freeMem() {
    hash1.clear();
    hash1 = null;
    TestClient.htm
    <HEAD>
    <TITLE></TITLE>
    <SCRIPT LANGUAGE="javascript">
    function window_onload()
    var hash1;
    testAppplet = document.TestRLApplet;
    for (cnt=0; cnt < 1000; cnt++)
    hash1= testAppplet.test1();
    </SCRIPT>
    </HEAD>
    <object
    classid = "clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
    WIDTH = 1 HEIGHT = 1 NAME = "TestRLApplet" >
    <PARAM NAME = CODE VALUE = "TestRLApplet.class" >
    <PARAM NAME = ARCHIVE VALUE = "../applets/TestRLApplet.jar" >
    <PARAM NAME = NAME VALUE = "TestRLApplet" >
    <PARAM NAME = MAYSCRIPT VALUE = true >
    <param name = "type" value = "application/x-java-applet;version=1.6">
    <param name = "scriptable" value = "false">
    </object>
    <BODY LANGUAGE=javascript onload="return window_onload()" leftMargin=40 id=body >
    </BODY>
    </HTML>
    Java Console
    Java Plug-in 1.6.0_10
    Using JRE version 1.6.0_10 Java HotSpot(TM) Client VM
    c: clear console window
    f: finalize objects on finalization queue
    g: garbage collect
    h: display this help message
    l: dump classloader list
    m: print memory usage
    o: trigger logging
    q: hide console
    r: reload policy configuration
    s: dump system and deployment properties
    t: dump thread list
    v: dump thread stack
    x: clear classloader cache
    0-5: set trace level to <n>
    Memory: 5,056K Free: 2,551K (50%) ... completed.
    Memory: 7,996K Free: 3,499K (43%) ... completed.
    Memory: 7,996K Free: 1,038K (12%) ... completed.
    Memory: 13,180K Free: 3,745K (28%) ... completed.
    Memory: 22,844K Free: 5,614K (24%) ... completed.
    Memory: 37,984K Free: 15,009K (39%) ... completed.
    Memory: 37,984K Free: 13,069K (34%) ... completed.
    Memory: 37,984K Free: 6,125K (16%) ... completed.
    Memory: 65,088K Free: 25,107K (38%) ... completed.
    Memory: 65,088K Free: 21,201K (32%) ... completed.
    Memory: 65,088K Free: 13,381K (20%) ... completed.
    Memory: 65,088K Free: 7,967K (12%) ... completed.
    Memory: 65,088K Free: 5,013K (7%) ... completed.
    Memory: 65,088K Free: 414K (0%) ... completed.

    What are you missing?
    I inherited this app and signing the third party jars is how it was setup, I was wondering the same thing too, why was it necessary to sign the third party jars?
    The applet runs in either JRE 1.6.0_13 or JRE 1.6.0_27 depending on the other Java apps the user uses. JRE 1.6.0_13 does not have the mixed code security (so it is like is disable), but JRE 1.6.0_27 does have the mixed code security and the applet will not launch with mixed code security enable, so we have to disable it. With all the hacking going on in the last two years, is important to improve security; so this is a must.
    Yes, I always clear up the cache.
    Any idea on how to resolve this problem?

  • Java and Javascript

    I am in the process of a doing my final year project. I have to make an Interactive Guide. I am going to use SQL for the database and then use Java to interact with the database. I would like advice on and if people know of any good sources on where I can find good information on how to get Java to interact with Javascript. I have looked at other interactive guide websites and found that they use Javascript but upon viewing the source code I am unable to work out how they get them to interact.
    Secondly I was wondering if I could be pointed to a good source of information or if people can pass on advice on how to create a good login system.
    Thank you.
    Tim

    msc85tjm wrote:
    I am in the process of a doing my final year project. I have to make an Interactive Guide. I am going to use SQL for the database and then use Java to interact with the database. I would like advice on and if people know of any good sources on where I can find good information on how to get Java to interact with Javascript. I have looked at other interactive guide websites and found that they use Javascript but upon viewing the source code I am unable to work out how they get them to interact.
    Secondly I was wondering if I could be pointed to a good source of information or if people can pass on advice on how to create a good login system.
    Thank you.
    TimDefine, "interact with java." Are you talking AJAX? Not too sure what you meant by that.
    And what do you mean by "good" login system. What's "good" to me may not be "good" to you. What does it need to do, how secure does it need to be, what are your implementation restrictions, etc....

  • How to call a java method so I can pass a file into the method

    I want to pass a file into a java method method from the main method. Can anyone give me some help as to how I pass the file into the method - do I pass the file name ? are there any special points I need to put in the methods signature etc ?
    FileReader file = new FileReader("Scores");
    BufferedReader infile = new BufferedReader(file);
    Where am I supposed to put the above text - in the main method or the one I want to pass the file into to?
    Thanks

    It's a matter of personal preference really. I would encapsulate all of the file-parsing logic in a separate class that implements an interface so that if in the future you want to start taking the integers from another source, e.g. a db, you wouldn't need to drastically alter your main application code. Probably something like this, (with an assumption that the numbers are delimited by a comma and a realisation that my file-handling routine sucks):
    public class MyApp{
    public static void main(String[] args){
    IntegerGather g = new FileIntegerGatherer();
    Integer[] result = g.getIntegers(args[0]);
    public interface IntegerGatherer{
    public Integer[] getIntegers(String location);
    import java.io.*;
    public class FileIntegerGatherer implements IntegerGatherer{
    public Integer[] getIntegers(String location){
    FileInputStream fs=null;
    try{
    File f = new File(location);
    fs = new FileInputStream(f);
    byte[] in = new byte[1024];
    StringBuffer sb = new StringBuffer();
    while((fs.read(in))!=-1){
    sb.append(new String(in));
    StringTokenizer st = new StringTokenizer(sb.toString(),",");
    Integer[] result = new Integer[st.countTokens()];
    int count = 0;
    while(st.hasMoreTokens()){
    result[count]=Integer.valueOf(st.nextToken());
    count++;
    catch(IOException e){
    //something sensible here
    finally{
    if(fs!=null){
    try{
    fs.close();
    catch(IOException f){
    return result;
    Once compiled you could invoke it as java MyApp c:\myInts.txt
    Sorry if there are typos in there, I don't have an ide open ;->

  • Error while calling applet from Javascript via LiveConnect and WebDriver

    Hi all,
    I am trying to call applet Java code from Javascript via WebDriver.
    Given the following two cases:
    - calling a static method: Integer.parseInt("42")- constructing a new object: new String("Hello world")My Javascript code looks like this:
    document.appletId.Packages.java.lang.Integer.parseInt("42");
    new document.appletId.Packages.java.lang.String("Hello world");When executing this code in Firefox via the Firebug Javascript console everything works fine and I get the expected results. However, when executing this code via the JavascriptExecutor from WebDriver only the call to the static method succeeds, the construction of the new object leads to the following error: "Attempt to call a default method on object with no invokeDefault method."
    I don't have any idea what is going wrong here, so any help would be greatly appreciated.
    Thanks!

    Hello Gerard, Hello Krishna,
    -> The liveCache application failed with COM error::
                                   40028 Illegal timestamp in rough timegrid
    More details about COM error 40028 you will see in TA /n/sapapo/om10
         -> Return code: 40028 -> execute ::
    Invalid time stamp in the time buckets profile relation     
    ( om_ts_tgrelinvalidstamp )     
       < click on '?' mark >
    -> Open an OSS message in accordance with SAP note 167280 if further help
         needed to solve the issue on your system.
    Thank you and best regards, Natalia Khlopina

Maybe you are looking for