Communicating between Applets on same web browser page.

I one wishes to do variable/function calls between seperate applets on one page,
-is there a simple way to do this (i.e. a global context object as a go between)?
Could I have/be pointed to an example?

Global context indeed. Your Applet will have a getAppletContext() method which returns an... AppletContext! And that has a getApplet(String) method which gets a reference to some other applet in the same context. The API documentation for that method contains more information than what I've posted here.

Similar Messages

  • Communication between applet and Web app (IE6 works IE7 doesn't)

    I'm not 100% sure this is the correct forum to post this in, but as the communication is initiated from the applet I'm posting it here.
    I have an applet that we are slowly breaking pieces out of into a web app.
    The details are as follows.
    The applet calls a servlet on the webserver with the following code.
    URL url = new URL("http://.................");
    ServletMessage message = new ServletMessage(url);
    InputStream returnStream = message.sendPostMessage(sending);The servlet takes the user credentials and other info that was sent and authenticates the user and stores the info that was passed into the session on the web server. Then based on the users permissions and where they want to go in the web app the servlets redirect method calls
    resp.getOutputStream().print("/AppName/appropriateServlet");This sends control back to the applet (including the url of the servlet that needs to be called) which then calls the appropriate servlet
    container.getAppletContext().showDocument(new URL("http://.............." + returnURL), "Title");Now the problem is that in the first and second servlet the request.getSession() returns two different sessions when running under IE7. IE6 returns reference to the same session.
    I don't know what has changed in IE7 but I was hoping somebody else has run into this, or can suggest a more appropriate forum to post this to?
    Thanks

    So the solution I came up with was when the applet jumps to the web app the first time instead of storing everything in session I store them in a map in the servletContext under their employee number.
    I then send control back to the applet with the url they should call. When the applet calls the web app for the second time it includes their employee number as parameter in the url.
    A Login filter then first checks to make sure it isn't on the first call, and checks to make sure they aren't in session... if so it pulls the map out of servletContext and transfers all the data back to the session and clears that user out of servletContext.
    So it stores the user in the servletContext during the transfer back and forth, then back in session like normal.
    I'm pretty sure it is going to work, but I can't test it because our mainframe test region is down which is what handles the authentication of the applet.

  • Communication between applets that are in different frames

    Hi,
    I have two applets in the same browser page but not in the same Frame, and I'm trying to invoke a method of one of the applets from the other. getApplet("NAME") does not work because both are in different frames.
    I have managed to do the communication with a static method, but the invoked method doesn't have the correct variables values (also defined static), these variables have the default values (i.e. int = 0).
    My program:
    Applet A --> loads the data and waits for Applet B's invocation.
    Later....
    Applet B --> invokes an Applet A's static method, Applet A receives the data, Applet A is supossed to work correctly, but its data is not the previously loaded but the default values.
    What am I doing wrong? Looking at this, it seems that the static method invoked is from a different class.
    Has anyone any working example? Is there another way (not signing)?
    Thanks

    You could do it using javascript. From what it looks like you are describing :
    In Applet A's page, have a javascript function that looks like the following :
    function callAppletB()
         self.parent.frame[1].document.getElementById("insert applet b's id here").methodName();
    }Then, in Applet B's page, make a similar function :
    function callAppletA()
         self.parent.frame[0].document.getElementById("insert applet a's id here").methodName();
    }Just make sure that Applet A's page is the first frame on your frameset page. Hope this helped.
    Ed

  • Database  applet error in web browser

    hi to all
    i have query in applet.
    MY APPLET IS USING ODBC AND CONNECTING TO ACCES.
    I HAVE CREATED POLICY FILE SO THAT I CAN DISPLAY APPLET IN APPLETVIEWER.
    APPLET RUNS FINE IS APPLETVIEWER WITH FOLLOWING COMMANDLINE
    Appletviewer -jDJava.security.policy = pol label.htm.
    however when i try to display applet in web browser, it display
    following error message "load-Can't instantiate class"
    any help will be welcome

    @MITZ:
    Christ, stop hijacking and multi-posting this same question all over the place!!!
    http://forum.java.sun.com/thread.jspa?threadID=707757
    http://forum.java.sun.com/thread.jspa?threadID=5186205
    http://forum.java.sun.com/thread.jspa?threadID=5190321
    http://forum.java.sun.com/thread.jspa?threadID=5187789
    http://forum.java.sun.com/thread.jspa?threadID=5190317
    @people who want to answer MITZ:
    I suggest doing so in the thread which was posted in the Signed Applets section of this forum:
    http://forum.java.sun.com/thread.jspa?threadID=5190324

  • Web Browser page is not getting displayed

    Hi,
    I have logged into SRM server thrugh web Browser.
    Roles are attached to the user.
    When i Click the Go shopping  -PAGE cannot be displayed " error is appearing.
    For some of the Nodes example --default setting page is displayed.
    We are in SRM 5.0 .
    The error is given below
    This is my URL
    *http://orange.dht.com:8000/sap/bc/gui/sap/its/bbpstart?sap-client=001&sap-language=EN*
    The page cannot be displayed
    If you typed the page address in the Address bar, make sure that it is spelled correctly.
    Regards
    G.Ganesh Kumar

    Hello Ganesh,
    As written by Iftekhar, check table TWPURLSVR.
    You can also have a look at OSS note 1145305 - SRM menu does not work as expected or any other SAP note dealing with this table.
    Regards.
    Laurent.

  • Opening OEM for two Oracle 11gR2 Databases in the same web browser automatically log out.

    Hi to everyone,
    I have an issue regarding Oracle Enterprise Manager in 11gR2. I have two database (SWPROD, PDPROD) in a single server. When I open the OEM URL for  SWPROD it is successfully logged on but when I open the OEM URL for PDPROD and successfully logged on the other tab for SWPROD will automatically logged out. And when I switch to the other tab for PDPROD it is also automatically logged out. Both OEM URL is open in a single web browser like Mozilla Firefox. What would be the reason why both OEM URL will be logged out when I open them at the same time?
    Thank you for your incoming response.

    Well it seems the only way to clear these out of EM was to shut BOTH RAC nodes down and power them up one at a time.  Now the updates aren't shown as required and my compliance score is where it should be.
    Is this a bug ?  Seems pretty stupid to have to shut down both RAC nodes to fix this.  Powering a single RAC node off and back on did not clear this.
    Unless i'm missing something??

  • Communication between applets using socket

    Hi,
    we have an application in which based on certain criteria a video is bieng played in the applet on same machine.Now we have to separate the video component from the application part so that video can be played separately. they will be communicated using socket.Can any body tell me how to go about for the solution.

    To do this you must have a server application listening to a port on a server box that has a fixed IP. In your Java app, you need to create a Socket connection back to the server (may need to sign your jar - but maybe not)
    voila you're there.
    You may want to search google + these forums for my InfoFetcher class which is built to grab data from an inputstream and report updates to listeners

  • Can applet close the Web browser window it embedded in?

    I know that a link or button in the Web browser can close the browser window. But I really don't if the applet can also do it.

    This site does have a search function you know, and if thats too much trouble there is google:
    http://www.google.com/search?q=site%3Asun.com+%22java+to+javascript%22&ie=UTF-8&hl=nl&lr=
    This should point you in the direction of a thing called JSObject
    Here is some code since I have this in my archive anyway:
    the 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"
                    >
            </object>
            <!-- <![endif]-->
          </object>
    <LABEL id="lblOutputText">This text is the HTML text </LABEL>the applet:
    // new class for jsObject!!!! compile this: javac -classpath "C:\Program Files\Java\j2re1.4.2_01\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
    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();
    }

  • Communication between Applets & Servlets

    How do you communicate in between Applets & Servlets ?

    http://forum.java.sun.com/thread.jsp?forum=45&thread=525518&start=0&range=15#2519429

  • Why does refreshing my web browser page increment the number of users connected to my Remote Front Panel?

    Hi,
    I'm using LabVIEW 2010 and a cRIO-9118 to broadcast my RT Front Panel on the web with a Web Server.
    I successfully configured the web server to be able to control my Front Panel remotely. However, I have an issue with "Refreshing" the browser.
    When I press "Enter" to search the adress of the web server, the number of users connected seems to increment by one and then tells me that "Too many users are connected to the front panel". Once this has been done, the only way to "unlock" the web server is to reboot the cRIO.
    Is there any solution to avoid this behavior?
    My current web browser is Internet Explorer 8.
    Thank you
    Mathieu Veillette, Ing Jr.
    Solved!
    Go to Solution.

    Hi Mathieu,
    Unfortunately, there currently isn't a very good solution for the problem you are facing. It seems like this is a known issue that R&D is working on. It so happens that in addition to simply refreshing, this issue also occurs if you try to access the Remote Front Panel using a second tab in a tabbed browser. One "fix" would be to invest in a higher count Remote Front Panel license. If that's not feasible, then the current recommendation would be to avoid connecting to the Remote Front Panel from a second tab or refreshing the view in your browser. Once you exceed the number of connections to the Remote Front Panel, you will have to restart the RT controller -- there isn't a way to change this default behavior. You can track any fixes by R&D by keeping note of the CAR (corrective action request) ID for this issue, which is #202702.
    Sanjay C.
    Embedded Software Product Manager| National Instruments

  • Applet to Applet communication between two seperate threads and jsp pages

    Hi,
    have two java applets running on two separate jsp pages. I am trying to have one applet talk to the other applet. I have tried putting the applets in a static hashtable, but I found out (through trial and error) that the memory is not shared between the applets. Needless to say the appletcontext object will not work as well. I have also tried to put the applet threads into a thread group, but it seems that the second applet can't find the first applet's threads. Is there a funky way that I need to create the threads for the threadgroup? Is there a way or type of object that I can use that will share the static memory between plugins? I am using 1.6 in IE. Or am I looking at this wrong and there is an easy way to do this and I am not seeing it.
    Thanks,
    Marc

    Hi Mylene,
    I hope I have understood your problem correctly. I can try to give you a tip. The times I've had to do a pop-up, for instance to show details or a part of the data in a table, I call a javascript function with the required parameters (an ID for details or an array of rows) when the button is pressed or a link is clicked. The function then builds a URL with all the paremeters and uses it to call the standard window.open function. After that the request is handled "as usual", ie as if you didn't actually do a pop-up but simply displayed a new page. The content of the pop-up is a jsp with all the required code to build the table and/or display the data. The contents of the table or data are retrieved with the help of the parameters sent.
    I'm not sure if the portal kit provides some kind of standard functionality for this, but in the cases I've worked with J2EE solutions this has been the most common way of solving the problem.
    I hope this helps.
    kind regards,
    Dionisios

  • Focus issues between Applets on a web page

    I have a web page that contains two applets(A1 and A2) each containing a JTable with editable cells.
    If I click on an editable cell in the table in applet A1 so this I can change it and I then click on an editable cell in the table in applet A2, I now have both cells available to edit.
    This is not the intent as I would like the focus to shift from A1 to A2 and editing stop on A1.
    I have tried a focusListener on the applet but that never seems to get called.
    Does anyone have an example of how to accomplish this?
    Jim

    I will try the newer SDK.
    Could you offer an example of how to setup the focusListener given the an applet declaration of:
    public class SimpleTableApplet extends JApplet {
        public void init() {
        public void foobar() {
    }and so forth.
    I would prefer not chasing phantoms.
    Thanks,
    Jim

  • Problems with multiple Domains open in same web browser?

    Here is the problem.
    I login to one domain and then open a new webpage (same browser) and login
    to a 2nd domain. I can then navigate in both domains in each web page.
    However, when I logout of one, it logs me out of both and which ever one
    that I logged out of is the logout/login page that I see for both web pages.
    The same thing happens if I try to login to 2 different domains at the same
    time. One will override the other and I end up with the same domain open in
    both browsers.
    I am pretty sure that this has to do with the cookie, since it is probably
    using the same one for both and then getting confused. Does anyone know how
    to fix this?
    Portal Server: IPS 3.0 SP2
    Web Server: IWS 4.1 SP8

    Brian Orwig wrote:
    Here is the problem.
    I login to one domain and then open a new webpage (same browser) and login
    to a 2nd domain. I can then navigate in both domains in each web page.
    However, when I logout of one, it logs me out of both and which ever one
    that I logged out of is the logout/login page that I see for both web pages.
    The same thing happens if I try to login to 2 different domains at the same
    time. One will override the other and I end up with the same domain open in
    both browsers.
    I am pretty sure that this has to do with the cookie, since it is probably
    using the same one for both and then getting confused. Does anyone know how
    to fix this?The way the cookies are set for the current authentication are it is based on
    the portal domain/dns domains and the client ipaddress.
    When a user logs in a random session id is generated, and then once he
    authenticates the session id is made valid and is added into the session hash
    table.
    So to answer your question you can do what your trying to do if you are using
    two browsers but in the current architecture and the way sessions are handled it
    is not possible if your using just one browser ..
    iWS Sp8 is not certified to run with portal and the web server that is shipped
    with should not be updated seperately, in the past doing that has broken portal
    >
    >
    Portal Server: IPS 3.0 SP2
    Web Server: IWS 4.1 SP8

  • No communication between applet - servlet

    hi
    my applet and my servlet is not at all communicating in the browser.
              any body knows how to solve this problem?
              in my applet code:Jus i am pasing as name string to invoke the serlvet via URL
              String location = "http://ctp-vi0275:8880/HandlePassword?"+"Name=XXX";
              URL testServlet = new URL( location );
              URLConnection servletConnection = testServlet.openConnection();
              servletConnection.setDoInput(true);
              servletConnection.setDoOutput(true);
              servletConnection.setUseCaches (false);
              servletConnection.setDefaultUseCaches (false);
              servletConnection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
              servletConnection.connect();
              i have changed server.xml file to listen the port number 8880.(in tomcat)
              in my servlet code:
              doGet Method in servlet
              String str = req.getParameter("Name");          
              System.out.println(str);
              here i am jus printing the name
              but when i run my applet is not at all invoking the serlvet - HandlePassword.I have placed the
              servlet in ROOT\web-inf\classes\HandlePassword
              in web.xml
              <web-app>
              <servlet>
              <servlet-name>HandlePassword</servlet-name>
              <servlet-class>HandlePassword</servlet-class>
              </servlet>
              <servlet-mapping>
              <servlet-name>HandlePassword</servlet-name>
              <url-pattern>/HandlePassword</url-pattern>
              </servlet-mapping>
              </web-app>
              where i am doing wrong here?

    You do following things and let me know:
    1. Does the servlet work when you type "http://ctp-vi0275:8880/HandlePassword?Name=XXX" in your browser?
    2. Run applet using appletviewer. Does it work?
    3. If it works using appletviewer then enable java console in your browser and see error stacks if any.
    4. If there are applet security errors on java console, try creating servlet URL in applet code by calling getDocumentRoot() method and see what happens.

  • How to display applet in the web browser?

    Hi Just want to ask help. Im making an application and i want to display applet in JSP. The problem is when i run my application there's no display in the browser. I already try to put the JSP and the Java Class with the same folder but still not working. Kindly help me with this one..
    Code:
    <jsp:plugin code="appletImage.class" codebase="applet" type="applet">
    </jsp:plugin>
    With this one i put my class in a package

    I think (correct me if im wrong) that that is the old way to do it i.e. it is now deprecated and that the recommended way now is to use the object tag
    Old deprecated way example
    <APPLET code="Bubbles.class" width="500" height="500">
    Java applet that draws animated bubbles.
    </APPLET>New recommended way example
    <OBJECT codetype="application/java"
            classid="java:Bubbles.class"
            width="500" height="500">
    Java applet that draws animated bubbles.
    </OBJECT>

Maybe you are looking for

  • How to browse local files in Client Side and pass to a text item?

    I am writing an Oracle 10g Form to get the path and filename from local PC (Windows XP) by clicking a Command Button, select the folder and files and then pass the full path and the filename to a Text Item. Does ORacle10g supports this feature? If ye

  • Payment made to all vendors

    Hi Friends, For a selected time interval I want to display the order and non order related payments made to all commercial vendors from SRM and ECC. For this the Document types are: RE KR KG TC How can I extract this data from SRM and ECC and from wh

  • First Website Attempt

    This is my first attempt at building a website. I have many questions, but I will start with a basic one. I have one image that I want to cover the entire page. How can I do that and then set the table up after the image is placed? Please remember th

  • How to find the Variable

    Hi, I searched in google i could not get proper anser. my question is how to find the varient is created are not. and also i am intrested to learn how to creat the variant... Thanks and regards, Kesava.

  • Why is my volume not working I have been having trouble with it

    I have been having problem with the volume it was garbled and now I have no volume what so ever please help fix it I have checked every thing on my end