Getting hold of browsers document object, from an applet

Well, at least that's how i think the problem will be solved.
The purpose is to insert some text into a hidden field on a form in the html where the applet is embedded.
so that this can be submitted along with the rest of the information that is entered through that page.
i've been looking at the AppletContext but i don't think this will provide what's necessary.
an alternate way of solving this would be to make an http-post with the information, since i prefer using our webserver to perform this.if this is the only way, is there a http-post object i can use for this, from an applet?

One way is to move the entire form into your applet so that it can do a post and send all the data itself (or vice-versa; avoid using the applet).
Another option might be to do it in two steps, have your form on one page then post all the details to the next page which contains the applet.
The only other option I can think of is to use JSObject to call a javascript function. Look at this link http://java.sun.com/products/plugin/1.2/docs/jsobject.html
Rob.

Similar Messages

  • How to create a Document object from a string.

    If I use the following code, the input String cannot contain "\n", otherwise, it generates errors.
    in the following code, inputXMLString is a String object that has xml content.
    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
    DocumentBuilder builder = factory.newDocumentBuilder();
    Document document = builder.parse(new InputSource(new StringReader(inputXMLString)));          How can I create a Document object from a string with "\n" in the string?
    Thanks.

    If I use the following code, the input String cannot
    contain "\n", otherwise, it generates errors.That's going to be a huge surprise to thousands of people who process XML containing newline characters every day without errors.
    Perhaps your newline characters are in the middle of element names, or something else that causes your XML to be not well-formed. I'm just guessing here, though, because you didn't say what errors you were getting.

  • How to get hold of the XPRequest object in the Login View

    Hi all,
    I need to customize the Login View to pre-populate the loginname field when a user hits the page. The difficult part is that the user is using PKI Cards, and I need to use the following server-side code fragment to retreive the Login Name.
    String loginName = "";Object o = request.getAttribute("javax.servlet.request.X509Certificate");
    // Got certificate => Windows XP PKI Card Userif (o != null) { String dnstring = ""; int startIndex = 0, endIndex = 0; java.security.cert.X509Certificate clientcert[] = (java.security.cert.X509Certificate[]) o; dnstring = clientcert[0].getSubjectDN().toString().toUpperCase(); // Gets the Login name // This is obtained by getting the portion of the string after "UID=" and befroe the next comma. startIndex = dnstring.indexOf("UID=") + 4; endIndex = dnstring.indexOf(",", startIndex+1); loginName = dnstring.substring(startIndex, endIndex);}
    The problem is that I can't seem to get hold of a XPRequest object (the Plumtree object used to wrap the JSP request object) in the Login View. I need this to call the request.GetAttribute method to retrieve the client certificate.
    Anyone knows how to do this? Or maybe I should be customizing another component instead?
    Thanks in advance for any suggestions!
    Weng Kong Lee

    From the 5.0.4 JavaDocs for AActivitySpace:
    com.plumtree.uiinfrastructure.activityspace.IXPRequest[b]GetCurrentHTTPRequest() Return the HTTP Request for the current request. com.plumtree.uiinfrastructure.activityspace.IXPResponse[b]GetCurrentHTTPResponse() Return the HTTP Response for the current request.
    Hope this helps clear things up.
    -- Don

  • Transporting Change document Object from development to quality

    Hi All,
    I have created a change document object from SCDO for my custom table. Now I want to transport this object from development server to quality server.
    As while creating Objects some enteries are made into standard table CDHDR and CDPOS which is client dependant so how to work this object on another client.
    Do I need to create seperate objects on quality server and then on production server?
    Thanks

    Hi Kiran,
    use transport connection to collect the objects to request, rsa1->transprot connection.
    use infocube as starting point to collect objects, left side choose 'object type', middle frame choose 'infocube' expand 'select objects', locate/search your infocube' and 'transfer', it will go to right side.
    in right up, there are buttons, click 'mode' and choose manual, and grouping 'only necessary objects', and execute, this will collect infocube and required objects like infoobjects, infoarea, etc.
    after that change grouping 'in dataflow before' and execute, this will collect update rules, ods, infosource, transfer rules, datasource assigned etc.
    remember to assign source system, click yellow box with X icon and mark the source system.
    after that use grouping 'in dataflow afterwards' to collect query, web template, role etc.
    take a look transport docs
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/3010ba90-0201-0010-2896-e58547c6757e
    http://help.sap.com/saphelp_nw2004s/helpdata/en/0b/5ee7377a98c17fe10000009b38f842/frameset.htm
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/e883de94-0501-0010-7d95-de5ffa503a86
    http://help.sap.com/saphelp_nw2004s/helpdata/en/b5/1d733b73a8f706e10000000a11402f/frameset.htm
    http://help.sap.com/saphelp_nw2004s/helpdata/en/57/38e1824eb711d182bf0000e829fbfe/frameset.htm
    Re: Transport Organizer---
    transport query (bex objects)
    http://help.sap.com/saphelp_nw2004s/helpdata/en/38/5ee7377a98c17fe10000009b38f842/frameset.htm
    hope this helps.
    (Courtesy AHP from Re: transport)
    Bye
    Dinesh

  • Record Management: get logical document object from physical doc. object

    Hello,
    I'd like to get logical document from physical document (sdok object - stricture containing class and objid).
    There is BAPI for "opposite direction": SDOK_LOIO_PHYSICAL_OBJECT_GET. By this FM I can get physical document's sdok object from logical document's sdok object.
    Can anybody tell me BAPI's name for it?
    I tried SDOK_PHIO_LOGICAL_OBJECT_GET, but this BAPI doesn't exist.
    Best regards,
    Josef Motl

    Josef,
    There are I don't believe there are any bapi's for this. You probably have to do this via ABAP OO. Create an object of the type CL_SRM_DOCUMENT. This is your logical (LOIO) object of your document. You have to enter the documentclass and the objectid of the document. This class has a method get_variant. This variant is your fysical (PHIO) object of the document. Use version and variant 0 so you will get the latest version object of your document.
    If this isn't the answer, can you please explain where do you get the fysical object from if you haven't got the logical first?
    Regards,
    Tjalling-Jan

  • Getting Error while creating Document object  after  parsing XML String

    Hi All,
    I have been trying to parse an XML string using the StringReader and InputSource interface but when I am trying to create Document Object using Parse() method getting error like
    [Fatal Error] :2:6: The processing instruction target matching "[xX][mM][lL]" is not allowed.
    seorg.xml.sax.SAXParseException: The processing instruction target matching "[xX][mM][lL]" is not allowed.
    Please find the code below which i have been experimenting with:
    import java.io.BufferedReader;
    import java.io.FileNotFoundException;
    import java.io.FileReader;
    import java.io.IOException;
    import java.io.StringReader;
    import java.util.List;
    import java.util.*;
    import javax.xml.parsers.DocumentBuilder;
    import javax.xml.parsers.DocumentBuilderFactory;
    import javax.xml.parsers.ParserConfigurationException;
    import org.w3c.dom.Document;
    import org.w3c.dom.Element;
    import org.w3c.dom.Node;
    import org.w3c.dom.NodeList;
    import org.xml.sax.InputSource;
    import org.xml.sax.SAXException;
    import java.io.*;
    public class TestMain {
         public static void main(String[] args) {
              String file = "";
              file = loadFileContent("C:\\Test.xml");
              System.out.println("contents >> "+file);
              parseQuickLinksFileContent(file);
    public static void parseQuickLinksFileContent(String fileContents) {
    PWMQuickLinksModelVO objPWMQuickLinksModelVO = new PWMQuickLinksModelVO();
         try {
    DocumentBuilderFactory factory =           DocumentBuilderFactory.newInstance();
         DocumentBuilder builder = factory.newDocumentBuilder();
         StringReader objRd = new StringReader(fileContents);
         InputSource objIs = new InputSource(objRd);
         Document document = builder.parse(objIs); // HERE I am getting Error.
         System.out.println(document.toString());
    What is happening while I am using builder.parse() method ???
    Thanks,
    Rajendra.

    Getting following error
    [Fatal Error] :2:6: The processing instruction target matching "[xX][mM][lL]" is not allowed.
    seorg.xml.sax.SAXParseException: The processing instruction target matching "[xX][mM][lL]" is not allowed.

  • Client unable to get the javax.activation.DataHandler object from Server

    Hi All,
    I am trying to download the file from the server to the client using Javax.Activation.Data Handler object with IBM web services. But server always returning the Data Handler object is null. I am wondering why it is behaving like this.
    My requirement is add the file to the Data Handler object from the server and read the same from the client. But I am always getting Data Handler object is  null at the client place.
    Please see the client side code and server side code below.
    Server side Code:
    This is the simple web service method, its creating the Data Handler object and adding it to the Hash Map and returning the Hash Map object to the client.
    public Hashtable download()
              DataHandler dh = null;
              HashMap hashMap =new HashMap();
              try{
                   //Sample test files contains data
                   String downLoadFName="C:/ADP/downLoadData.txt";
                   //Creating the DataHandler Object with sample file
                   dh      =      new DataHandler(new FileDataSource(new File(downLoadFName)));
                   //Keeping the DataHandler object in the HashMap.
                   hashMap.put("DATAHANDLER",dh);
                   //keeping the sample test message object in the HashMap
                   hashMap.put("TEST","Keeping the DataHandler and test messages in the hashTable");                         
              }catch(Exception e){
                   logger.error("Error :while sending the data:"+e.getMessage(), e);
              //retrun the HashMap object to the client.
              return hashMap;
    Client Side Code:
    This is the simple client code, and connecting to the server and invoking the web service method
    //This is the client code,Just invoking the webservice method from the Webspehre server.
    public class WebserviceClient {
         static DocumentTransfer controller     =     null;
         public static void main(String args[]){     
                DocumentTransferService service          =     null;
              try{
                   //Creating the service Object
                   service               =     new DocumentTransferServiceLocator();
                   //Getting the Server connection
                    controller          =      (DocumentTransfer)service.getDocumentTransfer(new java.net.URL("http://localhost:9081/eNetsRuntimeEngine/services/DocumentTransfer"));
                    //Calling the download method from the server and it returns HashMap object.
                   HashMap hashMap     = controller.download();
                   //Getting the DataHandler Object from the HashMap
                    DataHandler dh=(DataHandler)hashMap.get("DATAHANDLER");
                   System.out.println("DATAHANDLER: :"+dh);
                   //Getting the String object from the HashMap.
                   String message=(String)hashMap.get("TEST");
                   System.out.println(": :"+message);
               }catch(Exception e){
                    System.out.println("Exception :Not able to get the file :"+e.getMessage());
    Could you please give me some inputs on this?
    Thanks in advance,
    Sreeni.

    Hi Stif,
    Thanks for your response.I did debug from server side,it has printing content of Data Handler properly.
    Also i have debug request and response messages using TCP/IP monitor(RAD environment has this feature).The response from the server is going proplery.
    But the client side Data Handler is coming null.
    Any advice or solution would be greatly appreciated.
    Thanks,
    Sreeni.

  • Get a reference to an object from a touch

    I have no idea how to get the reference to an UIImageView object from a touch gesture. So far all I know how to do is get a reference to the touch. This is the code I have so far:
    - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
    printf("TOUCH ");
    UITouch *touch = [touches anyObject];
    CGPoint touchPoint = [touch locationInView:self.view];
    Any help would be greatly appreciated

    There may be more elegant methods, but what I did was to find out which sub views bounds covered the coordinates of the selected point. My task was easy since I had a sudoku grid, so converting coordinates into the index into an array of view instances was easy.
    - (unsigned int) setSelectedIndexForXCoordinate:(float) x YCoordinate:(float) y
    int column = (int) ( ( 9.0 * x ) / 320.0 );
    int row = (int) ( ( 9.0 * y ) / 320.0 );
    unsigned int index = ( ( row * 9 ) + column );
    [self setSelectedIndex:index];
    return index;

  • Getting hold of operating system windows from java program

    I want to make a java desktop application that is aware of other windows on the desktop. Targetted primarily for windows xp/vista.
    It should be able to "find" the current windows on the desktop (running from other applications) and draw a textual message ontop of them.
    Is this at all possible with java? And if so, can someone give me a point in the direction to take. What i would need first is a way to get hold of the windows, basically their size and x,y values somehow from within the java code...

    I want to make a java desktop application that is aware of other windows on the desktop. Targetted primarily for windows xp/vista.
    It should be able to "find" the current windows on the desktop (running from other applications) and draw a textual message ontop of them.
    Is this at all possible with java? And if so, can someone give me a point in the direction to take. What i would need first is a way to get hold of the windows, basically their size and x,y values somehow from within the java code...

  • How can I create a Document object from a text file (myFile.txt)

    Hi everybody:
    Thank you for reading this message.
    I am trying to find a method to convert a text file ( I have it in a File object) to a Document object.
    I read the Java API but it is strange, I do not know if I have to create an AbstractDocument, it is really strange for me.
    Any comment is welcome,
    Regards,
    JB

    Document is an interface, and AbstractDocument is abstract, so you
    can't create either of those directly. Assuming you are dealing with a
    a plain text file, you could do something like
    // Not catching any exceptions that get thrown
    File file = /* file you already have */
    String eol = System.getProperty( "line.separator" );
    int eolLen = eol.length();
    FileReader reader = new FileReader( file );
    BufferedReader buffer = new BufferedReader( reader );
    PlainDocument doc = new PlainDocument();
    for ( String line = buffer.readLine() ; line != null ; line = buffer.readLine() ) {
        int len = doc.getLength();
        if ( len > 0 ) {
            doc.insertString( len, eol, null );
            len += eolLen;
        doc.insertString( len, line, null );
    }and now you have a document.
    : jay

  • Getting a sequence of Point2D objects from a PathIterator?

    I would like to be able to take an arc or some other non-straight shape and convert it's geometry into a series of points that (roughly) traverse it. I attempted the following, as an example to see how it would work:
         arc = new Arc2D.Double(50,50,150,150,135,-270,Arc2D.OPEN);
         PathIterator pi = arc.getPathIterator(null);
         double[] coords = new double[6];
         int code;
         while (!pi.isDone()) {
              code = pi.currentSegment(coords);
              switch (code) {
              case PathIterator.SEG_CLOSE:
                   System.out.print("Close: ");
                   break;
              case PathIterator.SEG_CUBICTO:
                   System.out.print("Cubic To: ");
                   break;
              case PathIterator.SEG_LINETO:
                   System.out.print("Line To: ");
                   break;
              case PathIterator.SEG_MOVETO:
                   System.out.print("Move To: ");
                   break;
              case PathIterator.SEG_QUADTO:
                   System.out.print("Quad To: ");
                   break;
              default:
                   break;
              System.out.println(coords[0] + "," + coords[1] + "   " + coords[2] + "," + coords[3] + "   " + coords[4] + "," + coords[5]);
              pi.next();
         }The output was this:
    Move To: 71.96699141100893,71.96699141100893   0.0,0.0   0.0,0.0
    Cubic To: 101.25631329235418,42.6776695296637   148.74368670764582,42.6776695296637   178.03300858899107,71.96699141100893
    Cubic To: 207.32233047033628,101.25631329235418   207.32233047033628,148.74368670764582   178.03300858899107,178.03300858899107
    Cubic To: 148.74368670764582,207.32233047033628   101.25631329235418,207.32233047033628   71.96699141100893,178.03300858899107Clearly this isn't what I'm looking for. Does anyone have any suggestions on how I might go about doing this?
    Any input is appreciated.

    import java.awt.*;
    import java.awt.geom.*;
    import java.util.List;
    import java.util.*;
    import javax.swing.*;
    public class TraversePoints extends JPanel {
        Arc2D.Double arc = new Arc2D.Double(50,50,150,150,135,-270,Arc2D.OPEN);
        protected void paintComponent(Graphics g) {
            super.paintComponent(g);
            Graphics2D g2 = (Graphics2D)g;
            g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
                                RenderingHints.VALUE_ANTIALIAS_ON);
            g2.setPaint(Color.blue);
            g2.draw(arc);
            g2.setPaint(Color.red);
            AffineTransform at = AffineTransform.getTranslateInstance(150, 100);
            Point2D.Double[] points = getTraversalPoints(at, 1.0);
            for(int j = 0; j < points.length; j++)
                g2.fill(new Ellipse2D.Double(points[j].x-2, points[j].y-2, 4, 4));
        private Point2D.Double[] getTraversalPoints(AffineTransform at,
                                                    double flatness) {
            List<Point2D.Double> list = new ArrayList<Point2D.Double>();
            PathIterator pit = arc.getPathIterator(at, flatness);
            double[] coords = new double[6];
            int count = 0;
            while(!pit.isDone()) {
                int type = pit.currentSegment(coords);
                switch(type) {
                    case PathIterator.SEG_MOVETO:
                        // fall through
                    case PathIterator.SEG_LINETO:
                        list.add(new Point2D.Double(coords[0], coords[1]));
                        break;
                    case PathIterator.SEG_CLOSE:
                        System.out.println("CLOSE");
                        break;
                    default:
                        System.out.println("unexpected type = : " + type);
                count++;
                pit.next();
            System.out.printf("%d points at flatness = %.1f%n",
                               count, flatness);
            return list.toArray(new Point2D.Double[list.size()]);
        public static void main(String[] args) {
            JFrame f = new JFrame();
            f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            f.add(new TraversePoints());
            f.setSize(400,400);
            f.setLocation(200,200);
            f.setVisible(true);
    }

  • Need to paint objects from one applet into another

    Maybe this question is more at home here; I have an applet test program which uses the timer class to make a car drive across the screen. The test works fine with the rectangle I used, but now I need to use the car created in this class:
       import java.applet.Applet;
       import java.awt.Graphics;
       import java.awt.Graphics2D;
       import java.awt.Rectangle;
       import java.awt.geom.Ellipse2D; 
       import java.awt.geom.Line2D;
       import java.awt.geom.Point2D;
         public class Car extends Applet
              public void paint(Graphics g)
                   Graphics2D g2 =(Graphics2D)g;
                   Rectangle body =new Rectangle(100, 110, 60, 10);
                   Ellipse2D.Double frontTire =new Ellipse2D.Double(110, 120, 10, 10);
                   Ellipse2D.Double rearTire =new Ellipse2D.Double(140, 120, 10, 10);
                   Point2D.Double r1 =new Point2D.Double(110, 110);
                   //the bottom of the front windshield
                   Point2D.Double r2 =new Point2D.Double(120, 100);
                   //the front of the roof
                   Point2D.Double r3 =new Point2D.Double(140, 100);
                   //the rear of the roof
                   Point2D.Double r4 =new Point2D.Double(150, 110);
                   //the bottom of the rear windshield
                   Line2D.Double frontWindshield =new Line2D.Double(r1, r2);
                   Line2D.Double roofTop =new Line2D.Double(r2, r3);
                   Line2D.Double rearWindshield =new Line2D.Double(r3, r4);
                   g2.draw(body);
                   g2.draw(frontTire);
                   g2.draw(rearTire);
                   g2.draw(frontWindshield);
                   g2.draw(roofTop);
                   g2.draw(rearWindshield);
         }The only thing I could think of was making an object of type Car in the test program and then doing something like this:
    Car c =new Car();
    g2.draw(c.paint(g));
    But it says in the test program void type not allowed here. Any tips as to what I'm doing wrong? My guess is that its a problem in the Car class and not the test program, but I didn't think I was supposed to alter Car. (Plus I tried already and couldn't get it to work.)

    what? I don't see what you are trying to do..
    You are trying to make an instance of a class which has no constructor?
    You are trying to move a Panel (an Applet is a subclass of Panel) in another Panel (in Test class?)
    Keep in mind that the Panel automatically has flow layout. In flow layout the components are sized to minimum size, and if the component is another Panel, the minimum size is 0 if there are no components in it.
    Do you need both applets open at once?
    Why not just copy this paint code into your test class?
    Also note that you CAN copy the Graphics from one component onto another, but the Graphics object cannot be null, or you will get a NullPointerException... which is what will happen if you try to copy it in the init() of your test class.
    Why not just make your car a Component (or a Panel even) and give it a constructor? (And make sure to set minimum size to something other than zero?)
    I think you have more than one problem..
    Jen

  • Getting error in a soap proxy from an applet

    Hi, I'm getting error in Applet window while it trying to get the SOAP PROXY from Applet. Does any one came cross this type of the problem? Please help!!!
    <b>Description:</b>
    I am using BEA workshop 8.1.4, I have created JSP which contain the Applet. Applet has following two and more tags.
    codebase="/bea_wls_internal/classes/aanDemoTest@DemoWeb"
    code="ConnectionApplet"
    Where "ConnectionApplet" is simple java class extended from JApplet. Which try to get Java Proxy.
    <b>Code Section:</b>
    weblogic.jws.proxies.RmGetApi_Impl proxy =
    new weblogic.jws.proxies.RmGetApi_Impl(RMurl);
    RMClientProxy = proxy.getrmGetApiSoap();
    FYI: I have created client jar and webserviceclient jar a describe in one of the BEA Doc. Everything builds fine. But I am getting Error when I try to access from web(IE).
    <b>Error in JAVA-Plug-IN window:</b>
    unable to find the type mapping resource file for:weblogic.jws.proxies.rmGetApi
    I turn on the debug option in PLUG-IN and it show me that it trying to access the - rmGetApi.xml which is part of the clientjar file and it is not finding.I also test from my browser I can access the RmGetApi.class but I can't access the XML which is in same jar.

    Which window handle your talking about? Browser window?
    If so use the netscape.javascript pacakage
    import netscape.javascript.*;
    JP

  • Getting at a JAR file resource from an applet

    I have an applet, which contains a class DBFReader (which I did not write, and do not have source code to). DBFReader takes a string as an argument that indicates the file name/location:
    DBFReader mine = new DBFReader(String filelocation);
    The file I want to get at is in the same JAR file as the applet it is not in a subdirectory or package. I cannot figure out how to get at the file. I have already tried the following:
    DBFReader mine = new DBFReader(getClass().getResource("mydbffile.dbf"));
    and
    DBFReader mine = new DBFReader(getClass().getResource("mydbffile.dbf").getFile());
    Neither of these work. Is there any way for me to get at this file?
    Thanks,
    Patrick

    The error is runtime - the DBFReader throws an exception when you try to initialize it.
    Patrick

  • Calling COM object from an Applet

    Hi,
    Can an applet communicate with Microsoft COM object?
    Thanx

    Check out some software called JIntegra (commercial). Also, I think there used to be some sun stuff... but it got dropped... and then got picked up again... but I don't know what the status is on it.

Maybe you are looking for

  • Should I remove listeners?

    I don't understand if it is my responsibility to remove every listeners associated to a variable, before I set it to null. JTable aTable = new JTable( new SomeTableModel() ); aTable = new JTable( new SomeTableModel() );Even if this example isn't very

  • Reason for creating New Version Best practice

    Hello SAP Gurus, We know we are creating new version of the DIR when it is required to make a change in the original keeping in tact the Older file also for reference, we want to know when a new version of the document is getting created how can we s

  • GR-Based IV in PO

    HI MM Gurus / Experts, During PO Creation, I want that the GR-Based IV Flag should control from Vendor master instead of Info Record. IS IT Possible. If yes than How. Please explain. With thanks & Regards, DSC

  • Psd file wash out when add transparency to page

    HI, I've had a noticeable yet unknown problem, and today I figured out why, but now need help fixing it. Working with CS2 When I import a grayscale psd file into ID, it gets washed out when I add a transparent element to the page. My page started out

  • How do we make automatic and mass transports via Solution Manager

    How do we make automatic and mass transports via Solution Manager .. how can we do this is there any specific procedure please let me know Regards Karthik