Passing information from Applet to IE on the client

Hi everybody,
Does anybody know if it is possible to pass HTML formatted string (or any string for that matter) to the IE on the client without forcing browser to go back to server ?
The situation is the following - Applet application has all information it needs to form an HTML page to be presented in the separate Window by the Browser. At this point it sends it back to the server and then calls Browser with the appropriate URL. It obviously clumsy. I am looking for a way to pass it directly on the client side. It is OK if some permissions should be granted to the Applet.
Thanks in advance.

Your JavaScirpt can communicate with your applet. Provide some methods on your applet that the JavaScript can call to gather all information, then your JavaScript can place this in an html window.
Make sure you ID your applet or NAME your applet ie ID = "myApplet". The JavaScript can then access this object as document.myApplet.callSomeMethodOnThisApplet().

Similar Messages

  • Passing information from applet  to  java script  of same browser

    Hi
    i want to pass some information from applet button click to same browser window html elements where applet exist. how it can be possible
    Thanks
    Dev

    Use JSObject:
    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>applet
    // 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 from applet</h1></center>");
            }catch(Exception e){
                 e.printStackTrace();
    }

  • HT201250 how can i pass information from one mac to another mac by using the time capsule

    how can i pass information from one mac to another mac by using the time capsule

    If you want to transfer files, settings, etc., you must open Migration Assistant (Applications > Utilities) in the Mac that you want to transfer the files and follow the instructions

  • Passing information from external asp file and getting it in the portal

    Hi,
    I think that the answer for my question is simple but I'm not sure how it is done.
    I would like to pass information from asp page(microsoft server pages) to the portal and extract the information in the portal
    I know how to how to pass the the information as POST or GET method
    but how do I extract the infomation within an iView ?
    and what is the portal URL I need to call from the asp page ? a page URL or an iView URL ?
    Thanks
    Y.R

    Hi,
    In order to use an ASP application in the portal u have to first create a system. In the System Definition Properties, give the url of your ASP page in the Name of server field and the name of the ASP page in the URI field.
    For more clear understanding, please go through the following document
    http://help.sap.com/bestpractices/crossindustry/enterpriseportal/v160/documentation/How-to_Guides/25_HowToUseAppIntegrator_en.pdf
    Best Regards
    Priya

  • How can I pass information from one portlet to another?

    First, some background...
    I am using Portal 5.0.2 and developing portlets using JSP/Java on a remote server.
    I need to pass information from a portlet on pageA to another portlet on pageB, but I can't do it using the traditional methods, such as query string, session, cookies, etc. due to either portal framework limitations or because of functional constraints (basically, a user will not necessarily be logged in to the portal, but he can view anything available to the GUEST user). Here are the different ways I've considered using to save state and their limitations:
    Query string: can't use this because portlets on remote servers don't have access to it
    Cookies: if user disables cookies, code will not function properly
    Session variables: limited to one user's connection with one portlet (i.e., can't access a session variable set in portletA from portletB)
    Application variables: because the user may not be logged in, I have no way of uniquely naming variables, which is a necessity in order to maintain state for EACH user
    User Settings: again, the user may not be logged in, so I can't use these
    PCC: can't access client-side variables because server-side JSP executes first
    Are my assumptions above correct? Has anyone had any success using one of these methods given the same constraints, or does anyone have an alternative solution? I'd certainly appreciate any help anyone could provide.
    Thanks,
    Jose

    One possibility would be to use a Login PEI to set a unique UserInfo Name/Value for the user. I think in 5.0 each guest session is unique, so would have unique UserInfo. Then you could pass this value to your portlet (by specifying it in the web service) and use it as a key into a Application-scoped hashmap where you store your info. In other words, your Application variables option, but you have a way of uniquely naming your variables via PEI-set UserInfo.

  • Passing information from an iView to SAP - ESS Related

    Hi,
    How do you pass information from an iView to SAP?
    For example, in my task the User will log into ESS.
    Then they will click on the iView link and be prompted with a dialog for their service number (how is that done)?
    Now, on SAP's side (backend), I need to take that service number and their user id and pass it to the transaction.
    For the service number, I will have to add leading zero's.
    How is this done?
    What is the ESS cookbook and does anyone have it?
    Thanks,
    John

    Thank you for the response - it gives me a better idea of how this system works.
    But how would you modify the information that is being passed? Would it be passed to a structure, which can be accessed from within SAP? For example, the medical service number would be entered as 15. It would be stored and then my program would extract that number, add leading zero's and call the relevant transaction.
    Please help.

  • Passing information from JClient to View Object

    What would be best way to pass information from JClient to View Object. I would like to implement security system, where view object would take information about what specific users can do (not oracle users, I would like to have one user to connect to database only) from an oracle table or stored procedure. Now I need to pass information about user: user name, IP, application etc. to View Object. I have two ideas for possible solution:
    a) dynamic attributes
    b) exporting methods (with custom interface)
    Any suggestions ?
    Todi

    What would be best way to pass information from JClient to View Object. I would like to implement security system, where view object would take information about what specific users can do (not oracle users, I would like to have one user to connect to database only) from an oracle table or stored procedure. Now I need to pass information about user: user name, IP, application etc. to View Object. I have two ideas for possible solution:
    a) dynamic attributesPreferable if you need to store per row information that's dynamic/required for client.
    b) exporting methods (with custom interface)Preferable if it's a one time setup kind of information. Though even that can be achieved by the dynamic attributes.

  • Passing Information From Socket to GUI

    Hi, I'm making a chat client, but I'm having trouble passing information from server's input stream to my GUI. I made two threads, one for sending and one for receiving, and I start them both when I click "connect" after I log in to the server. So what happens is I run my program, the frame appears as I want it to, and then I click connect, and after a little wait the button "unclicks" (or w/e) and nothing happens. I don't know why I am not receiving the messages from the server. If I make the program "GUI-less" it works, I can both send and receive messages via the console. But in the GUI, where I am sending/receiving via my two TextAreas, it doesn't work. Here's my code:
    (I apologize ahead of time for posting so much code in a thread, I tried to cut it down as best as I could.)
    BotWindow class (GUI) - Action Listeners
    public void createProps() {
            outText.setLineWrap(true);  //Text Areas
            outText.setForeground(Color.white);
            outText.setBackground(Color.blue);
            outText.setEditable(false);
            inText.setLineWrap(true);
            inText.setForeground(Color.white);
            connect.addActionListener(this);    //Action Listeners
            disc.addActionListener(this);
            submit.addActionListener(this);
    BotWindow class (GUI) - actionPerformed for connect/disc
    public void actionPerformed(ActionEvent evt) {
            JButton src = (JButton)evt.getSource();
            if(src == connect) {
                try {
                    bnet = new BattleNet("useast.battle.net");
                    bnet.logIn("dynobot1", "test");
                catch(Exception error) {
                    System.out.println(error);
            if(src == disc) {
                try {
                    BattleNet bnet = new BattleNet("useast.battle.net");
                    bnet.logOut();
                catch(Exception error) {
                    System.out.println(error);
    BattleNet class
    import java.io.*;
    import java.net.*;
    public class BattleNet extends SendAndReceive {
        Socket sock;
        InputStream in;
        OutputStream out;
        Send send;
        Receive receive;
        public BattleNet(String server) {
            try {
                sock = new Socket(server, 6112);
                in = sock.getInputStream();
                out = sock.getOutputStream();
                send = new Send(this.out);
                receive = new Receive(this.in);
            catch(Exception error) {
                System.out.println(error);
        public void logIn(String username, String password) {
            byte[] u = username.getBytes();
            byte[] p = password.getBytes();
            try {
                out.write((byte) 0x03);
                out.write((byte) 0x04);
                out.write(u);
                out.write((byte) 0x0a);
                out.write(p);
                out.write((byte) 0x0a);
                receive.start();
                send.start();
            catch(IOException e) {
                System.out.println(e);
        public void logOut() {
            try {
                sock.close();
                in.close();
                out.close();
            catch(Exception error) {
                System.out.println(error);
    SendAndReceive class (with Threads as subclasses)
    import java.io.*;
    import java.net.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class SendAndReceive implements ActionListener {
        JButton src = null; 
        public SendAndReceive() {} 
        public void actionPerformed(ActionEvent evt) {
            src = (JButton)evt.getSource();
    class Send extends Thread {
        OutputStream out;
        SendAndReceive sr = new SendAndReceive();
        BotWindow bw = new BotWindow();
        public Send(OutputStream inputOut) {
            out = inputOut;
        public void run() {
            if(sr.src == bw.submit) {
                String newLine = "\n";
                String messageOut = bw.inText.getText();
                bw.outText.setText(bw.outText.getText() + newLine + messageOut);
                byte[] m = messageOut.getBytes();
                try {
                    out.write((byte) 0x05);
                    out.write(m);
                catch(IOException e) {
                    System.out.println(e);
                String blank = "";
                bw.inText.setText(blank);
                sr.src = null;
    class Receive extends Thread {
        InputStream in;
        SendAndReceive sr = new SendAndReceive();
        BotWindow bw;
        public Receive(InputStream inputIn) {
            in = inputIn;
            bw = new BotWindow();
        public void run() {
            while(true) {  //thinking of doing while(sr.src != bw.submit)
                try {
                    bw.outText.setText(bw.outText.getText() + (char)in.read());
                catch(IOException e) {
                    System.out.println(e);
    }So, to repeat my question, why isn't my GUI receiving the data being passed to it from the BattleNet socket? Also, am I taking the right approach on separating the send and receive methods and is my threading correct?

    Just Look at this code...
    while(true) {  //thinking of doing while(sr.src != bw.submit)
    try {
    bw.outText.setText(bw.outText.getText() + (char)in.read());
    catch(IOException e) {
    System.out.println(e);
    The problematic area is this code itself.
    Try to read text Line by Line basis. You can do this by using readLine() rather than read().
    The modified code should be like this:
    while(true) {  //thinking of doing while(sr.src != bw.submit)
    try {
    String TextRead=in.readLine();
    String Prev_text=bw.outText.getText();
    String new_Text=Prev_text + new_Text;
    bw.outText.setText(new_Text);
    catch(IOException e) {
    System.out.println(e);
    This would make the code easy to read and modify.
    I have faced these kindaa problems during my JAVA project coding. However they have been solved by using a much simpler approach like the one I have used. Although they do the same thing, but anyhow it provides a better result for reasons quite unknown to me!!!

  • Passing Information From Server to GUI

    Hi, I'm making a chat client, but I'm having trouble passing information from server's input stream to my GUI. I made two threads, one for sending and one for receiving, and I start them both when I click "connect" after I log in to the server. So what happens is I run my program, the frame appears as I want it to, and then I click connect, and after a little wait the button "unclicks" (or w/e) and nothing happens. I don't know why I am not receiving the messages from the server. If I make the program "GUI-less" it works, I can both send and receive messages via the console. But in the GUI, where I am sending/receiving via my two TextAreas, it doesn't work. Here's my code:
    (I apologize ahead of time for posting so much code in a thread, I tried to cut it down as best as I could.)
    actionPerformed method for connect and disconnect buttons (in BotWindow class)
    public void actionPerformed(ActionEvent evt) {
            JButton src = (JButton)evt.getSource();
            if(src == connect) {
                try {
                    bnet = new BattleNet("useast.battle.net");
                    bnet.logIn("dynobot1", "test");
                catch(Exception error) {
                    System.out.println(error);
            if(src == disc) {
                try {
                    BattleNet bnet = new BattleNet("useast.battle.net");
                    bnet.logOut();
                catch(Exception error) {
                    System.out.println(error);
    BattleNet class
    import java.io.*;
    import java.net.*;
    public class BattleNet extends SendAndReceive {
        Socket sock;
        InputStream in;
        OutputStream out;
        Send send;
        Receive receive;
        public BattleNet(String server) {
            try {
                sock = new Socket(server, 6112);
                in = sock.getInputStream();
                out = sock.getOutputStream();
                send = new Send(this.out);
                receive = new Receive(this.in);
            catch(Exception error) {
                System.out.println(error);
        public void logIn(String username, String password) {
            byte[] u = username.getBytes();
            byte[] p = password.getBytes();
            try {
                out.write((byte) 0x03);
                out.write((byte) 0x04);
                out.write(u);
                out.write((byte) 0x0a);
                out.write(p);
                out.write((byte) 0x0a);
                receive.start();
                send.start();
            catch(IOException e) {
                System.out.println(e);
        public void logOut() {
            try {
                sock.close();
                in.close();
                out.close();
            catch(Exception error) {
                System.out.println(error);
    SendAndReceive class (with Threads as subclasses)
    import java.io.*;
    import java.net.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class SendAndReceive implements ActionListener {
        JButton src = null; 
        public SendAndReceive() {} 
        public void actionPerformed(ActionEvent evt) {
            src = (JButton)evt.getSource();
    class Send extends Thread {
        OutputStream out;
        SendAndReceive sr = new SendAndReceive();
        BotWindow bw = new BotWindow();
        public Send(OutputStream inputOut) {
            out = inputOut;
        public void run() {
            if(sr.src == bw.submit) {
                String newLine = "\n";
                String messageOut = bw.inText.getText();
                bw.outText.setText(bw.outText.getText() + newLine + messageOut);
                byte[] m = messageOut.getBytes();
                try {
                    out.write((byte) 0x05);
                    out.write(m);
                catch(IOException e) {
                    System.out.println(e);
                String blank = "";
                bw.inText.setText(blank);
                sr.src = null;
    class Receive extends Thread {
        InputStream in;
        SendAndReceive sr = new SendAndReceive();
        BotWindow bw;
        public Receive(InputStream inputIn) {
            in = inputIn;
            bw = new BotWindow();
        public void run() {
            while(true) {
                try {
                    bw.outText.setText(bw.outText.getText() + (char)in.read());
                catch(IOException e) {
                    System.out.println(e);
    }So, to repeat my questions, SendAndReceive class, but I'm not sure if this is the right approach.why isn't my TextArea (BotWindow.outText) not receiving and setting it's text to the information from the server? Is my threading correct? Also, with the way I set up the threads, will the Send function be able to send in the midst of the receive function? I tried to set it up so that it could by implementing ActionListener in my SendAndReceive class, but I am not sure if this is the correct approach.
    P.S. The reason I put this in Swing is because it works without a GUI/Swing components! If it will help, I will post the GUI-less program I made that works.

    Multi-post. Reply to this posting: http://forum.java.sun.com/thread.jspa?threadID=656211

  • I was transferring my information from my old iphone to the new one, and i forgot that i had some pictures in the new one. i did the restoring information and the pictures in new one are gone. how can i get them back????

    i was transferring my information from my old iphone to the new one, and i forgot that i had some pictures in the new one. i did the restoring information and the pictures in new one are gone. how can i get them back???? please

    Only way to get it back is to restore your phone from a backup, if those pics were included in that backup.
    But most likely those pics are gone.
    What you should've done was import http://support.apple.com/kb/HT4083 the pics to your computer and after you restored from your old backup, you could sync those new pics to your phone via itunes.

  • Passing variables from php to flash and the opposite

    Hi guys, im trying weeks now to solve this problem but nothing yet
    If someone could just tell me how to pass variables from flash to php and the opposite i would be thankful!!! Please help!

    I have recently had to learn this, so this may not be the best way but it worked for me
    I suggest looking at the code below stripping out everything you don't need (e.g. the databse stuff) and just get a simple string going back and forward
    have a go and post any problems here and I'll try and help
    in flash i have
    private function getBalanceAndXP():void
              var request:URLRequest = new URLRequest("utils.php");
              request.method = URLRequestMethod.POST;
              var variables:URLVariables = new URLVariables();
              variables.func = "getBalance";
              variables.fbid = userID;
              request.data = variables;
              var loader:URLLoader = new URLLoader();
              loader.dataFormat = URLLoaderDataFormat.VARIABLES;
              loader.addEventListener(Event.COMPLETE, onBalanceComplete);
              loader.load(request);
    private function onBalanceComplete(e:Event):void
              var loader:URLLoader = e.target as URLLoader;
              loader.removeEventListener(Event.COMPLETE, onBalanceComplete);
              var variables:URLVariables = new URLVariables(loader.data);
              _balance = parseInt(variables.balance); // class variable
              _experience = parseInt(variables.experience); // class variable
    public function setBalanceAndXP(balance:int, experience:int):void
                _balance = balance;
              _experience = experience;
              var request:URLRequest = new URLRequest("utils.php");
              request.method = URLRequestMethod.POST;
              var variables:URLVariables = new URLVariables();
              variables.func = "setBalance";
              variables.fbid = userID;
              variables.balance = _balance;
              variables.experience = _experience;
              request.data = variables;
              var loader:URLLoader = new URLLoader();
              loader.dataFormat = URLLoaderDataFormat.VARIABLES;
              loader.load(request);
    and then I have my php file
    <?php
    $func = $_POST["func"];
    $fbid = $_POST["fbid"];
    $balance = $_POST["balance"];
    $experience = $_POST["experience"];
    $numVariables = 0;
    $link = mysql_connect("localhost","username","password");
    mysql_select_db("databaseName");
    if ($func == "getBalance")
              getBalance($fbid);
    else if ($func == "setBalance")
              setBalance($fbid, $balance, $experience);
    mysql_close($link);
    function getBalance($fbid)
              $query = "SELECT balance, experience FROM tableName WHERE fbid = '".$fbid."'";
              $result = mysql_query($query);
              $row = mysql_fetch_row($result);
              writeVariable("balance", $row[0]);
              writeVariable("experience", $row[1]);
    function setBalance($fbid, $balance, $experience)
              $query = "UPDATE tableName SET balance = ".$balance.", experience = ".$experience." WHERE fbid ='".$fbid."'";
              mysql_query($query);
    function writeVariable( $name, $value )
              global $numVariables;
              if ( $numVariables > 0 )
                        echo "&";
              echo $name . "=" . urlencode($value);
              $numVariables++;
    ?>

  • Need to pass information from MS access database to another prog

    Hi,
    I really need some help here...
    I need to pass selected information from my database to another information.
    I am able to select and display the infotmation but i am not sure how i can transfer the information to the next program. Can any one please offer me some assistance?
    My code is as follow:
    /* Getting data from PSM32 and displaying it *can work* */
    import java.net.URL;
    import java.sql.*;
    import java.lang.String;
    /** Application to create a Ganttchart * */
    public class PSMdb
    public static void main (String argv[])
    //SQLQueryFormat a = new SQLQueryFormat();
    System.out.println("\nEstablishing Connection - Pls Wait... \n");
    /** Get Info fr database**/
    try
         //Connect to the database specified in the URL
         Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
         Connection con = DriverManager.getConnection("jdbc:odbc:PSM32");
         System.out.println("Connection Established.\n");
         //Create a SELECT statement object
         Statement statmt = con.createStatement();
         //Issue the SELECT statement
         String querySt = "SELECT Set, Name, Order " +
         "FROM PMETERS " +
         "WHERE Set = 'BRAKE.BAK' ";
         //Create and execute query
         ResultSet res = statmt.executeQuery(querySt);
           while (res.next())
                String Proj = res.getString(1); //get Proj Name
              String Task = res.getString(2); //get Task Name
              //Print statement
              System.out.println("" +Proj);
              System.out.println("" +Task);
           //Close Statement and Connection
         statmt.close();
         con.close();
         System.out.println("\nConnection Closed - Operation Successful.");
         catch(Exception E)
    //Print out the Exception Error
    System.out.println("Error:" +E );
    }And yes there is another problem. I can compile and run the program in a C:\folder but when i open the document in a project workspace, i cant compile the above code. Can any one please offer me assistance?
    Thanks a million.

    To NanookOITheNorth:
    Could you provide some more relevent information
    about what the other program is and how data should
    be transferred to it? API? Socket? File?was wanted to use the "return task" thing. Issit possible to use that?
    To annie79:
    my next program is supposed to retrive the events in the "task" field and display it in a applet. After retriving the tasks i will be getting the dates to produce the gantt chart. uses the jfree lib functions.
    the code for the applet is as follow
    /* original gantt chart program that can work*/
    import java.applet.*;
    import java.awt.*;
    import javax.swing.*;
    import java.awt.event.*;
    import java.util.Calendar;
    import java.util.Date;
    import org.jfree.chart.ChartFactory;
    import org.jfree.chart.ChartPanel;
    import org.jfree.chart.JFreeChart;
    import org.jfree.data.category.IntervalCategoryDataset;
    import org.jfree.data.gantt.Task;
    import org.jfree.data.gantt.TaskSeries;
    import org.jfree.data.gantt.TaskSeriesCollection;
    import org.jfree.data.time.SimpleTimePeriod;
    /** Application to create a Ganttchart * */
    public class Ganttchart extends JApplet{
    /** @param title , frame title **/
        public void init() {
            final IntervalCategoryDataset dataset = createDataset();
            final JFreeChart chart = createChart(dataset);
            // add the chart to a panel...
            final ChartPanel chartPanel = new ChartPanel(chart);
            // this size (500, 270) here doesn't matter cos this become the html control
            // how big u wan can change in the html code the width="800" height="600"
            chartPanel.setPreferredSize(new java.awt.Dimension(500, 270));
            setContentPane(chartPanel);
         * Creates a sample dataset for a Ganttchart.
         * @return The dataset.
        public static IntervalCategoryDataset createDataset() {
         //"Task" information should be retrived from the database to replace this current 1
            /*final TaskSeries s1 = new TaskSeries("Scheduled");
            s1.add(new Task("Write Proposal",
                   new SimpleTimePeriod(date(1, Calendar.APRIL, 2001),
                                        date(5, Calendar.APRIL, 2001))));
            s1.add(new Task("Obtain Approval",
                   new SimpleTimePeriod(date(9, Calendar.APRIL, 2001),
                                        date(9, Calendar.APRIL, 2001))));
            s1.add(new Task("Requirements Analysis",
                   new SimpleTimePeriod(date(10, Calendar.APRIL, 2001),
                                        date(5, Calendar.MAY, 2001))));
            final TaskSeries s2 = new TaskSeries("Actual");
            s2.add(new Task("Write Proposal",
                   new SimpleTimePeriod(date(1, Calendar.APRIL, 2001),
                                        date(5, Calendar.APRIL, 2001))));
            s2.add(new Task("Obtain Approval",
                   new SimpleTimePeriod(date(9, Calendar.APRIL, 2001),
                                        date(9, Calendar.APRIL, 2001))));
            s2.add(new Task("Requirements Analysis",
                   new SimpleTimePeriod(date(10, Calendar.APRIL, 2001),
                                        date(15, Calendar.MAY, 2001))));*/
            final TaskSeriesCollection collection = new TaskSeriesCollection();
            collection.add(s1);
            collection.add(s2);
            return collection;
         * Utility method for creating <code>Date</code> objects.
         * @param day  the date.
         * @param month  the month.
         * @param year  the year.
         * @return a date.
        private static Date date(final int day, final int month, final int year) {
            final Calendar calendar = Calendar.getInstance();
            calendar.set(year, month, day);
            final Date result = calendar.getTime();
            return result;
         * Creates a chart.
         * @param dataset  the dataset.
         * @return The chart.
        private JFreeChart createChart(final IntervalCategoryDataset dataset) {
            final JFreeChart chart = ChartFactory.createGanttChart(
                "Ganttchart",  // chart title
                "Task",              // domain axis label
                "Date",              // range axis label
                dataset,             // data
                true,                // include legend
                true,                // tooltips
                false                // urls
    //        chart.getCategoryPlot().getDomainAxis().setMaxCategoryLabelWidthRatio(10.0f);
            return chart;   
    }As for the "run the program in a C:\folder but when i open the
    document in a project workspace, i cant compile the
    above code. Can any one please offer me assistance?"The run time error that i get is "java.lang.NoSuchMethodError: main
    Exception in thread "main" "
    Please give me some leads on how i can cont to proceed?
    Thanks a lot

  • Pass byte[] from applet to servlet

    I have an application that allows users to copy an image from the system clipboard into a frame. What I would like to be able to do, is save that image into a database (db2 on as/400). In order to do that, I try to send the image, which I turned into a byte[] in order to easily insert into the database, from the applet to the servlet using streams (no actual file io), but the image always comes up null when I pass it to the servlet. What am I doing wrong? The image gets copied and drawn from the clipboard just fine, but I can't send it to the servlet. I only included the part of the servlet that tries to retreive the byte array. I know the applet code is a little long, but I figured it might be of interest to someone. Please help!
    Here's the code for the applet:
    import java.awt.*;
    import java.awt.event.*;
    import java.applet.*;
    import java.awt.datatransfer.*;
    import java.net.*;
    import java.io.*;
    import javax.swing.ImageIcon;
    import java.util.*;
    import java.awt.image.*;
    public class PicApp extends Applet implements ClipboardOwner
    PrintWriter opWriter = null;
    private Button cmdPaste = new Button();
    private ImageControl destinationImage = new ImageControl ();
    private BorderLayout defaultLayout = new BorderLayout ();
    public Image tempImage = null;
    public ImageIcon transferImage = null;
    private String webServerStr = "";
    private String hostName = null;
    private int port = 80;
    private String servletPath = null;
    Clipboard clipboard;
    //the byte array I try to pass
    public byte[] passed = null;
    public String passedAction = null;
    public void init()
    try
    opWriter = new PrintWriter( new BufferedWriter( new FileWriter( "pictureDetails.txt" ) ) );
    catch(Exception e)
    e.printStackTrace();
    hostName = getParameter("HostName");
    servletPath = getParameter("ServletPath");
    passedAction = getParameter("Action");
    //setLayout
    this.setLayout (defaultLayout);
    this.setBackground(java.awt.Color.gray);
    cmdPaste.setLabel("Paste Image from Clipboard");
    this.add (cmdPaste, BorderLayout.SOUTH);
    this.add (destinationImage, BorderLayout.NORTH);
    //add action listener
    cmdPaste.addActionListener (new cmdPasteActionListener ());
    //initialize the clipboard
    clipboard = getToolkit().getSystemClipboard();
    // get the host name and port of the applet's web server
    try
    opWriter.println("Picutre Applet Details\n");
    URL hostURL = getCodeBase();
    opWriter.println("hostURL = " + hostURL.toString() + "\n");
    hostName = hostURL.getHost();
    opWriter.println("hostIP = " + hostName + "\n");
    port = hostURL.getPort();
    opWriter.println("port = " + port + "\n");
    if (port == -1)
    port = 80;
    if(passedAction == "" || passedAction == null)
    webServerStr = "http://" + hostName + ":" + port + servletPath;
    opWriter.println("Web String full = " + webServerStr);
    else
    webServerStr = "http://" + hostName + ":" + port + servletPath + "?act=" + passedAction;
    opWriter.println("Web String full = " + webServerStr);
    opWriter.close();
    catch(Exception e)
    e.printStackTrace();
    // INNER CLASSES
    class cmdPasteActionListener implements ActionListener
    public void actionPerformed (ActionEvent event)
    Transferable clipboardContent = clipboard.getContents(this);
    //Transferable clipboardContent = Toolkit.getDefaultToolkit().getSystemClipboard().getContents(null);
    if ((clipboardContent != null) && (clipboardContent.isDataFlavorSupported(DataFlavor.imageFlavor)))
    try
    //display Image
    tempImage = (Image)clipboardContent.getTransferData(DataFlavor.imageFlavor);
    destinationImage.setImage(tempImage);
    int width = (new ImageIcon(tempImage).getIconWidth());
    int height = (new ImageIcon(tempImage).getIconHeight());
    PixelGrabber pg = new PixelGrabber(tempImage, 0, 0, width, height, true);
    passed = new byte[width*height];
    passed = (byte[])pg.getPixels();
    //send Image
    ProcessPicture();
    catch (UnsupportedFlavorException e)
    catch (IOException e)
    }//end of if
    else if(clipboardContent == null)
    }//end of method
    }//end of inner class
    public PicApp()
    public void lostOwnership (Clipboard parClipboard, Transferable parTransferable)
    System.out.println("Lost ownership of clipboard");
    protected void ProcessPicture()
    try
    // connect to the servlet
    URL servletURL = new URL( webServerStr );
    //URLConnection servletConnection = servletURL.openConnection();
    HttpURLConnection servletConnection =(HttpURLConnection)servletURL.openConnection();
    // inform the connection that we will send output and accept input
    servletConnection.setDoInput(true);
    servletConnection.setDoOutput(true);
    // Don't used a cached version of URL connection.
    servletConnection.setUseCaches (false);
    // Specify the content type that we will send binary data
    servletConnection.setRequestProperty("Content-Type", "application/octet-stream");
    // send the image object to the servlet using serialization
    sendImageToServlet(servletConnection);
    // now, let's read the response from the servlet.
    // this is simply a confirmation string
    readServletResponse(servletConnection);
    catch (Exception e)
    System.out.println(e.toString());
    protected void readServletResponse(URLConnection servletConnection)
    BufferedReader inFromServlet = null;
    try
    // now, let's read the response from the servlet.
    // this is simply a confirmation string
    inFromServlet = new BufferedReader(new InputStreamReader(servletConnection.getInputStream()));
    String str;
    while (null != ((str = inFromServlet.readLine())))
    System.out.println("Reading servlet response: " + str);
    inFromServlet.close();
    catch (IOException e)
    System.out.println(e.toString());
    protected void sendImageToServlet(URLConnection servletConnection)
    ObjectOutputStream outputToServlet = null;
    try
    // send the image object to the servlet using serialization
    outputToServlet = new ObjectOutputStream(servletConnection.getOutputStream());
    //check size of image
    System.out.println(passed.length);
    // write objectt
    outputToServlet.writeObject(passed);
    outputToServlet.flush();
    outputToServlet.close();
    catch (IOException e)
    System.out.println(e.toString());
    servlet:
    public void performTask(HttpServletRequest request, HttpServletResponse response)
    ObjectInputStream inputFromApplet = null;
    byte[] ImageFromApplet = null;
    PrintWriter out = null;
    BufferedReader inTest = null;
    try
    // get an input stream from the applet
    inputFromApplet = new ObjectInputStream(request.getInputStream());
    // read the serialized imageIcon data from applet
    ImageFromApplet = (byte[])inputFromApplet.readObject();
    inputFromApplet.close();
    catch(Exception e)
    // handle exception
    byte[] transferImage = ImageFromApplet;
    if(transferImage == null)
    System.out.println("Image passed is empty!");

    D,
    I read your code. I believe you are trying to send the byte array with the wrong outputStream.write method. For a byte[] I have successfully used the form, servletOut.write(byteArray, 0, byteArray.length). You have to tell the receiver how much data will be sent to it so it knows when to stop read in the data.
    Example:
    _url = new java.net.URL(serverURL);
    //Attempt to connect to the host
    java.net.URLConnection connection = _url.openConnection();
    // Initialize the connection
    connection.setUseCaches(false);
    connection.setDoOutput(true);
    connection.setDoInput(true);
    connection.setRequestProperty("Content-type", "application/octet-stream");
    BufferedInputStream fileInputStream = new BufferedInputStream(fIS);
    int nBytesAvailable = fileInputStream.available();
    byte byteArray[] = new byte[nBytesAvailable];
    fileInputStream.read(byteArray, 0, nBytesAvailable);
    fileInputStream.close();
    fIS.close();
    // send data to servlet, get outstream, write data, flush, close.
    DataOutputStream outStream = new DataOutputStream(connection.getOutputStream());
    outStream.write(byteArray, 0, nBytesAvailable);
    outStream.flush();
    outStream.close();

  • Passing values from applet using POST method to PHP page

    Hello there ;)
    I realy need a help here.. I`ve been working all day on sending mail from applet. I didn`t succeed bcs of the security restrictions.
    So I decided just to pass arguments into PHP page, which process them and send e-mail to me.
    So here is the problem.. I need to send String variables througth POST into my php page. Now I`m using GET method, but I need more than 4000 characters.
    My actual solution is:
      URL url = new URL("http://127.0.0.1/index.php?name=" + name + "&message=" + message);
    this.getAppletContext().showDocument(url,"_self");I really need to rewrite it into POST. Would you be so kind and write few lines example [applet + php code]? I`ve already searched, googled, etc.. Pls don`t copy links to other forums here, probably I`ve read it.
    Thanx in advance to all :)

    hi!
    i`ve got some news about my applet.. so take this applet code:
    public class Apletik extends JApplet {
        public void init() { }
        public void start()
        try
          String aLine; // only if reading response
          String  parametersAsString = "msg=ahoj&to=world";
          byte[] parameterAsBytes = parametersAsString.getBytes();
          // send parameters to server
          URL url = this.getCodeBase();
          url = new URL(url + "spracuj.php");
          URLConnection con = url.openConnection();
          con.setDoOutput(true);
          con.setDoInput(true); // only if reading response
          con.setUseCaches(false);
          con.setRequestProperty("Content=length", String.valueOf(parameterAsBytes.length));
          OutputStream oStream = con.getOutputStream();
          oStream.write(parameterAsBytes);
          oStream.flush();
          String line="";
          BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
          while ((aLine = in.readLine()) != null)
           JOptionPane.showMessageDialog(null, aLine);      
           if(aLine.equals("")) break;
          in.close();      
          oStream.close();
        catch (Exception ex)
          JOptionPane.showMessageDialog(null, ex.toString());
    }here is code of spracuj.php which is on server:
    <?php
      if(isset($_POST['msg']))
        echo('hurray!');
    ?>it has only 1 problem.. when i test it on my localhost, everything seems to be all right. but when i post it to my server, i got IOException HTTP 400 error code :( where is the problem? please help me, i`m so close :D thanx

  • Passing Information from UCCX call variables through trunk SIP to Astersik

                       Hi All,
    We need to pass some informations from our UCCX 8.5SU3/CUCM 8.6.2a to our Asterisk Server.
    This two PBX are connected by a trunk sip.
    Is it possible to do it?I've read about sip header,but i've never work on it.
    Is it possible with a javascript?
    Could you please help us?
    Thanks
    Stefano

    No. CCX uses JTAPI (CTI/QBE) to integrate with CUCM, not SIP. As such there is no mechanism for it to manipulate or add extra SIP headers. You would need to use one of the native scripting options (e.g. ODBC, HTTP GET/POST, SMTP) or write a custom Java class that can interface natively with the other application. Examples of this exist such as the excellent documents on SFTP, CIFS, and LDAP.
    Please remember to rate helpful responses and identify helpful or correct answers.

Maybe you are looking for

  • Add marker to Google Map

    Hi there.  I am creating an iPad app with In Design CS5.5. I want to add a link from an image with a button to a Google map showing where the image was taken. I can successfully add the map and load it but I cannot find out how to add the marker show

  • Charting library with JRockit

    Using Weblogic Platform 8.1.4. When using JRockit JVM with JFreeChart sometimes the JRockit will crash. Apparently this is a bug with JRockit as when we switch to Sun JVM we don't have this problem. So since switching to Sun JVM is not an option for

  • How do i send picture via text msg?, how do i send picture via text msg?

    how do i send picture via text msg?

  • Update 4.2.1 didnt do anything at all.

    hi, I just updated my ipods software to the new 4.2.1 version and looked it up to find all the stuff it should have added. But my ipod has NONE of the "new" stuff it was supposed to add. It shows on the apple.com website that a ipod touch 3rd generat

  • TS5185 can i turn off imessage from itunes

    Can I turn off imessage through itunes