HTML form over Flash bkd in Safari

Hi, I've got a site which uses an animated Flash background
element which is overlayed with a div containing an HTML form. It
works fine in every browser I have, except Safari. In Safari, as
soon as I click in the form, the entire HTML content of the page
disappears. The form and links will still function, but are
invisible.
Does anyone know about this problem? Is there a workaround,
or am I doing something wrong?
The page is
here.
Please note that the site is in a pretty early stage of
development, and not a lot of it works, but at least it
demonstrates the Safari problem.
Thanks!
Michael

i got someone to check on safari if their browser needed
updating for the flash plug-in but it didnt, still no luck with
this... I think I will try a few things and see what happens, any
other ideas though, I really can't explain why its doing
this?

Similar Messages

  • Re-build HTML Form in Flash?

    Hi
    Wonder if someone can help. Please excuse my incompetence, I am fairly new to Flash / Actionscript
    Basically I am trying to re-build this simple HTML form in Flash, I have not shown the actual URL here, but this is a functioning form when the correct URL is in place:
    <form action="http://www.customersURLhere/" method="post">
      <input type="text" name="vrm"/>
      <input type="submit" value="go"/>
      <input type="hidden" name="update" value="false"/>
      <input type="hidden" name="source" value="aexp"/>
      <input type="hidden" name="supplier" value="AEMP" />
    </form>
    I have attempted to re-build this in flash. I have 1 text input field which I have set the variable name to 'vrm' to match the input field above. I then created a basic flash button and set the following action:
    on (release) {update = "false";source = "aexp";
    supplier = "AEMP";
    getURL ("http://www.customersURLhere", "", "POST");
    Can anyone spot any obvious errors???
    Any help would really be appreciated.

    Thanks for your help.
    Unfortunately I am still struggling to get this to work.
    I have applied your script to the button, is that correct? (The button is on it's own layer and has one keyframe at the start or the movie.)
    Do I need to label/name the button 'submitBtn' in some way?
    You added a comment '//do whatever'... do I need to add something here?
    Sorry, I'm a complete novice!!

  • Converting HTML form to Flash for Paypal!

    Hello! Im currently in the process of converting my HTML website to Flash. On my website, i am using Paypal buttons (add to cart) so now i need to convert my 3 buttons/form to Flash. Here is my website: http://www.tubesjujubes.com/En/buyonline.html
    I found this tutorial to help me: http://www.actionscript.org/resource...ash/Page1.html
    but something is still wrong! Everytime i click on the button, it brings me to the log in page of Paypal instead of 'your cart' page. See HTML site for what i mean.
    Ive only tried the tutorial on one button so far since i wanted it to work before i applied it to the others. This is the HTML code on my website for my first button:
    <form target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post">
    <input type="hidden" name="cmd" value="_s-xclick" />
    <input type="hidden" name="hosted_button_id" value="1699962" />
    <input type="hidden" name="on0" value="Choose your membership" />Choose your membership:
    <select name="os0">
    <option value="1 kid + 1 parent">1 kid + 1 parent $99.00
    </option><option value="2 kids + 2 parents">2 kids + 2 parents $178.00
    </option></select>
    <br /><br />
    <input type="hidden" name="currency_code" value="CAD" />
    <input type="image" src="https://www.paypal.com/en_US/i/btn/btn_cart_LG.gif" border="0" name="submit" alt="" />
    <img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1" />
    </form>
    Now this is how i created my form/button in flash:
    Every component and input box are on the same layer.
    The actions are on a separate action layer.
    I create a ComboBox for my choices with an instance name of 'os0'. I imported the button img, converted it to a button and called it 'submit'. For the action of the button, i used: on (release) {
    getURL ("https://www.paypal.com/cgi-bin/webscr", "POST");
    Then i created 4 hidden input box, that i placed outside of the scene. I gave them a var title, using the 'name' from the HTML code and then added the values for each input box on the action layer like this:
    cmd = "_s-xclick";
    hosted_button_id = "1700073";
    on0 = "Choose your membership";
    currency_code = "CAD";
    And its still wont work! And i have no clue what im doing wrong! PLEASE HELP!

    I was able to figure out how to get my btn to redirect to my shopping cart. Basically, you just need to make sure everything is on the btn action layer. At first i have my hidden values on a action layer in the main page and the getURL my btn layer. Now my btn layer looks like this:
    on (release) {
    // Hidden Input fields for Form
    cmd = "_s-xclick";
    hosted_button_id = "1699962";
    on0 = "Choose your membership";
    currency_code = "CAD";
    getURL ("https://www.paypal.com/cgi-bin/webscr", target="paypal", "POST");
    Now my problem is that the values of my combo box arent read and i have no idea how to code it. Can anyone help me with this? Should i code it in actionscript or can i just do it in property inspector box? I know what the problem is but i dont know how to fix it! My button is missing some coding since its not picking up the values of the combo box.
    Anything could help! Thanks!

  • Help with layering HTML over Flash?

    I am using stylesheets to layer an html table over a flash element. The page renders properly in Safari but in IE, there are some display problems. The table cell bumps over to the right. Can anyone assist?
    http://www.kleewebdesign.com/hpcc/index2.html

    Start by validation your page here:
    http://validator.w3.org/
    It will tell you that you must declare a DOCTYPE, more info:
    http://www.w3schools.com/tags/tag_doctype.asp
    Then learn how to use Z-indexing here:
    http://www.w3schools.com/cssref/pr_pos_z-index.asp
    You will also need to give the container <div>s declared positions:
    http://www.w3schools.com/css/css_positioning.asp
    Here is example of Flash layered between 2 layers of HTML:
    http://www.cidigitalmedia.com/tutorials/qt/play_qt.html
    Best of luck,
    Adninjastrator

  • HTML Form-like behavior in Flash

    Hello,
    I'm looking to find a reference that can help me in the
    creation of Flash user input screens that behave in a manner
    analogous to an HTML form. Specifically I'm concerned with error
    checking and data validation. For example, if a user is creating a
    new record or editing an existing record and they choose to
    navigate away from the page, the code should check for data
    changes, and on finding any offer the user an option to save the
    data. Once the offer is made and responded to the flow of the
    application should proceed appropriately.
    In an HTML form this type of behavior would be accomplished
    with an appropriately worded JavaScript "confirm" dialog. This
    dialog allows for a synchronous interaction between the user and
    the flow of the JavaScript code in which user choice results in how
    the code flow proceeds. With Flash, such a synchronous event is not
    inherently possible (to the best of my admittedly limited
    experience). Without this type of "confirm" dialog, one must create
    a custom messaging system to communicate with the user, and must
    also structure the code in such a way that everything is able to
    achieve the desired effects in an asynchronous manner.
    I've tried searching this forum but I don't know how to
    phrase my search in order to find good results. If anyone has any
    ideas, links to resources, links to threads, or any other items
    that might help in my quest to build fully optimized and robust
    user input forms in Flash CS3, I'd really appreciate the help.
    Thanks in advance for any advice!
    Regards,
    Dave

    Why not just use a DataGrid component? They're pretty easy to
    use actually.
    Try this: start a new AS2 project and drag a DataGrid from
    the components
    panel onto the stage. Use the properties panel to size it to
    500 x 300. When
    you add data to a grid it will just show a scroll bar if
    necessary, it
    doesn't resize... Give it an instance name of "theGrid".
    Now, add the following script to the frame:
    import mx.controls.gridclasses.DataGridColumn;
    function doGrid(gridRef, gArray:Array)
    for (var i = 0; i < gArray.length; i++) {
    var cat:DataGridColumn = new DataGridColumn(gArray
    [0]);
    cat.width = gArray[2];
    cat.headerText = gArray
    [1];
    cat.editable = false;
    gridRef.addColumn(cat);
    var gFormat = new Array(["fname", "First Name:", 120],
    ["lname", "Last
    Name:", 200], ["date", "Win Date:", 80]);
    doGrid(theGrid, gFormat);
    If you compile now, you'll see the grid with the field
    titles... I use the
    doGrid function, and an array like this to make formatting
    the grid easy.
    The first item in the array matches the dataProvider
    property, as you will
    see in a moment - the second is the title, and the third the
    width of the
    column... change these as you need.
    To add data, you just create an array of objects, with the
    object properties
    matching the first item in the format array - like so - add
    the following
    and test again:
    var gridData = new Array({fname:"Dave", lname:"Mennenoh",
    date:"09/14/08"},
    {fname:"giga", lname:"saurus", date:"10/14/08"});
    theGrid.dataProvider = gridData;
    That's all there is to it... If you add more data than can be
    shown, you'll
    get a scroll bar. You can add en event listener to know when
    someone selects
    an item, etc...
    good luck
    Dave -
    www.offroadfire.com
    Head Developer
    http://www.blurredistinction.com
    Adobe Community Expert
    http://www.adobe.com/communities/experts/

  • 10.4.7: broken safari menus over flash applets

    It seems after the 10.4.7 safari update: 2.0.4 (419.3), javascript menu dropdowns that hover over flash do not work properly. This can be viewed at http://www.bestbuy.com. Try to use the menu(s) above the main flash applet and you'll see what I mean. I also use the Nightly WebKit and this issue is not present (build 15091).
    Power Mac G5 Dual 2Ghz/iBook G4 1.42Ghz   Mac OS X (10.4.6)   2.5 Gig, Rad 9800 Pro 256M

    Hello,
    Thanks very much for the look,
    You're quite welcome. Always glad to help out.
    I upgraded my G5 and
    the iBook so I had no way of checking the site after
    the fact. The latest webkit seems to have this fixed
    so maybe in a futre release when the webkit merges
    with safari, it will be fixed.
    Which webkit is that? Are you talking about some of the developer software through Apple's Developer Connection?
    Or, are you talking about some 3rd-party updates, or nightly builds of the Flash program?
    I wasn't aware that Safari had a nightly build update like some of the other Open Source projects.
    Perhaps I am just misunderstanding your statement.

  • Flash navigation and HTML forms

    Wondering if any one can help. Whenever I use an html form on
    an html page, my flash navigation will not show up. The area where
    it should be is blank and my browser status bar says that there are
    two items remaining (my flash navs). The browser stays like this
    indefinately, not completely loading the page.
    Any suggestions ?
    Thanks,
    Elise

    Thank you for reply. I appreciate it. So, if I understand
    correctly:
    I would embed the navbar.swf in all my html files. Then Each
    button would go to each html pages (Like page1.htm page2.htm
    etc...) Then I use your code in my html file right? Like each html
    file will have the following code:
    <param name="movie" value="nav.swf?frame=page2">
    Is that how it works. Sorry for not being able to your
    answer.
    Thank you very much again

  • Modify flash movie from HTML form

    so here is what I have:
    I have a flash movie and as the flash movie plays there are
    elements that say things like, "Your company name here" or "Your
    title here", or "Your Product Picture here" etc.
    From an HTML form (I can do all this part) I would want
    someone to be able to specify their customized information and
    SOMEHOW that would end up in the Flash movie. I would like to know
    whether I need special software to create these. I ultimately need
    have the final product be a .swf with the form-entered information
    like Company Name, etc.
    I don't know what I need in order to do this. I'm basically
    info-gathering. Ask any questions if I am leaving anything out that
    might help you help me identify what we need.
    Thanks in advance.

    no. none from me. i honestly dont have the first clue

  • Safari have problems with streaming radio over flash

    Hello,
    since my update on MAC OS LION have my safari problem with radio streaming over flash.
    For testing: http://shoutcast.flashradio.info/#/House/814384/
    In all browsers on all platforms will this work. Just on the combination from MAC OS LION and Safari 5.1 we get the io error #2032.

     Try changing some Advanced wireless settings on the router. Open the setup page of the router and go to Wireless tab. Click on Advanced wireless settings. Change beacon Interval to 75, RTS threshold to 2304. Save the settings.
    Change the wireless channel to 11.
    An 802.11n router can also work with 802.11g and even 11b devices. But these much slower devices force the router to slow down to talk to them, which means a big throughput hit. Fortunately, the "legacy" mechanisms are pretty efficient and reduce throughput only when the slower devices are actively transmitting or receiving. Either upgrade to all 11n clients, or use a separate 802.11g router to handle your "legacy" stuff.

  • Dropdowns over Flash

    I'm trying to develop a dropdown navigation but it won't show
    properly over Flash, it'll work in Safari but not Firefox, and
    especially on a PC ie6+7
    http://www.pollenbrooks.com/en/indextest.html
    Are there any workarounds?

    All Active content on a page will always rise to the top, so
    to speak,
    including Flash, certain form elements, Java applets, and
    Active X controls.
    This means that each of these will poke through layers. There
    is not a good
    cross-browser/platform reliable way to solve this issue, but
    if you can be
    confident in your visitors using IE 5+ or NN6+, then you can
    use the Flash
    wmode parameter (however, Safari does not support this
    properly!).
    Adobe articles:
    http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=tn_15523
    http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=tn_14201
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    ==================
    "entrancesw" <[email protected]> wrote in
    message
    news:fllgk7$bn1$[email protected]..
    > Were you able to get the menu to work properly in
    Firefox after adding the
    > wmode parameter? I was having the same problem, included
    wmode=transparent
    > and
    > still had the menu hiding behind the flash movie in
    Firefox. Thanks for
    > any
    > info.
    >

  • Opening an HTML popup from Flash, not as tab

    Hi
    I need to open an HTML popup from Flash (using ActionScript in
    Flex 4).
    Thus far I found a solution, and it does work in Safari - a new
    and separate HTML window is popped up (with a new web page).
    private function popUpTheHtmlEditor():void {
      var url:String = "http://www.adobe.com";
      var request:URLRequest = new URLRequest(url);
      try {
        navigateToURL(request, '_blank');
      } catch (e:Error) {
        trace("Error occurred!");
    But in (my) Firefox (with my settings), when I click on the Flash
    (Flex) button, the page is being opened in a new tab.
    I need a solution which pops up the HTML page in a new/separate
    window, as far as possible regardless of the browser (and browser
    settings).
    I found an example where a popup is opened from HTML, and it opens a
    separate window (a real popup) in my Firefox:
    http://www.gtalbot.org/FirefoxSection/Popup/PopupAndFirefox.html
    -> "Open a requested popup"
    The JavaScript code seems to be:
      OpenRequestedPopup(this.href, this.target); return false;
    with this function def:
      function OpenRequestedPopup(strUrl, strTarget)
        if (WindowObjectReferenceOfRequestedPopup == null || WindowObjectReferenceOfRequestedPopup.closed)
        WindowObjectReferenceOfRequestedPopup = window.open(strUrl, strTarget, "top=" + windowTop + ",left=" + windowLeft + ",width=" + windowWidth + ",height=" + windowHeight + ",menubar,toolbar,location,resizable,scrollbars,status");
        else
        if(WindowObjectReferenceOfRequestedPopup.focus)
          WindowObjectReferenceOfRequestedPopup.focus();
    How could I call such code from ActionScript? Should this work through
    ExternalInterface? I couldn't even get this to work:
      ExternalInterface.call('alert', 'foo');
    Should I use swfobject.js for embedding the .swf in the HTML wrapper?
    Any other ideas?
    The two files are pasted below.
    Here's the compiler command I'm using:
      mxmlc -output button.swf -target-player 10.0.0 flash_to_editor.mxml
    I'm running the examples locally (as files, not over http). Would it
    help to place the files on a server?
    Tobi
    <?xml version="1.0" encoding="UTF-8"?>
    <mx:Application
      xmlns:fx="http://ns.adobe.com/mxml/2009"
      xmlns:s="library://ns.adobe.com/flex/spark"
      xmlns:mx="library://ns.adobe.com/flex/mx"
      horizontalAlign="center" verticalAlign="middle">
      <fx:Script>
        <![CDATA[
    import mx.controls.Alert;
    import flash.external.ExternalInterface;
    import flash.net.URLRequest;
    // This 'http://www.adobe.com' is just an example URL.
    // Works but opens tab in FF (not a separate window):
    private function popUpTheHtmlEditor():void {
      var url:String = "http://www.adobe.com";
      var request:URLRequest = new URLRequest(url);
      try {
        navigateToURL(request, '_blank');
      } catch (e:Error) {
        trace("Error occurred!");
    // Doesn't work:
    // var url:URLRequest = new URLRequest("javascript:alert('foo'); void(0);");
    // navigateToURL(url, "_self");
    // How to get this to work?
    private function popUpTheHtmlEditor():void {
      ExternalInterface.call('alert', 'foo');
    // How to get this to work?
    private function popUpTheHtmlEditor():void {
      ExternalInterface.call('launch','http://www.adobe.com');
      // Or
      // ExternalInterface.call("window.open", "http://www.adobe.com", "win", "height=200,width=300,toolbar=no,scrollbars=yes");
    // Perhaps it's necessary to try different approaches:
    // (As soon as I get two approaches to work.)
    private function popUpTheHtmlEditor():void {
      var s:String;
      if (ExternalInterface.available) {
        // Necessary? Safe?:
        // Security.allowDomain('*');
        s = ExternalInterface.call('launch','http://www.adobe.com');
      } else {
         // TODO: Then try URLRequest?
         s = "Wrapper not available";
      Alert.show(s);
        ]]>
      </fx:Script>
      <s:Panel title="One way to open the HTML editor"
      width="75%" height="75%">
        <s:Button id="button" label="Open the HTML editor"
        click="this.popUpTheHtmlEditor();"
        horizontalCenter="0" verticalCenter="0"/>
      </s:Panel>
    </mx:Application>
    <html
      xmlns="http://www.w3.org/1999/xhtml"
      xml:lang="en" lang="en">
      <head>
        <title>html_around_swf.html</title>
        <script type="text/javascript">
    function launch(url) {
      alert(url);
      //  OpenWin = this.open(url, "FOO", "toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=no,width=400,height=200");
        </script>
      </head>
      <body>
        <object id="button" name="button" width="550" height="400"
        classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000">
          <param name="movie" value="button.swf" />
          <param name="allowScriptAccess" value="always" />
          <embed id="foo" name="button" src="button.swf" width="550" height="400"></embed>
        </object>
      </body>
    </html>

    Hi, 
    Here's a solution.
    1. Make ExternalInterface work when files are loaded as local files: 
    Go to
    http://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager04.htm l 
    In tab Global Security Settings: Edit Locations -> Add Location ->
    browse to the .swf file, add it. Make sure it's in the list (under the
    Edit Locations drop down, with a green check mark.) 
    Now open the HTML wrapper in a browser (eg Firefox). 
    Now this works (ActionScript): 
    private function popUpTheHtmlEditor():void {
      ExternalInterface.call('alert', 'foo');
    On Windows: perhaps:
    http://techjig.blogspot.com/2008/03/flash-global-security-settings-windows.html
    "In order for external interface functions to be called, you must also
    specify the folder/file where the swf file is located." 
    The above setup isn't necessary when the files are on a server. 
    Also see: 
    http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/external/External Interface.html#call()
    ""ExternalInterface" "
    "call() method" 
    http://help.adobe.com/en_US/flex/using/WS2db454920e96a9e51e63e3d11c0bf69084-7ea6.html
    "About ExternalInterface API security in Flex" 
    http://help.adobe.com/en_US/flex/using/WS2db454920e96a9e51e63e3d11c0bf626ae-7fe8.html#WS2d b454920e96a9e51e63e3d11c0bf69084-7f31
    "Using the ExternalInterface API to access JavaScript" 
    2. Open a real popup: Example: 
    ActionScript: 
    private function popUpSomething():void {
      var editorPathOrUrl:String =
        'wrapper.html';
      var windowName:String =
        "SomeNameSeeDocs";
      var windowFeatures:String =
        "toolbar=yes,menubar=yes,location=yes,scrollbars=yes,resizable=yes,width=500,height=700";
      ExternalInterface.call(
        'launch',editorPathOrUrl,windowName,windowFeatures
    JavaScript: 
    function launch(editorPathOrUrl,windowName,windowFeatures) {
      windowRef = window.open(
        editorPathOrUrl,windowName,windowFeatures
    Works in all browser I tested except Opera. 
    Tobi

  • Is it possible to create a contact form via Flash cs5.5 and package out app for desktop?

    I need to create a desktop app for windows.  Im using Flash cs5.5 and I wanted to know of an easy to way to create a simple contact form that would work once installed on a desktop/
    Thanks guys for any input!

    If you want a contact form you can either use StageWebView or HTMLLoader to show an HTML page in your web server with a contact form.
    Or you can create the form with Flash textfields and then send the whole thing with a POST request to a PHP script in the server, for example.

  • Adobe Flash Player for Safari

    I can't get Adobe Flash player to install in Safari 5.0.3. Please advise...

    Adobe Flash is pretty much a 32-bit application. You may be able to fix the problem by going into your Applications folder, and right-clicking on Safari. There is a check box that will allow you to run Safari in 32-bit mode. Try that and see if Flash works in Safari.
    I have retired my iMac, and have an HP now, but a friend helped me with the same problem when I upgraded to Snow Leopard. My PC seems to have just one 64-bit browser, that being Internet Explorer. I am using IE9 Beta in 64-bit, and the Beta for Flash "Square" in 64-bit seems to work fine. See link below:
    http://labs.adobe.com/downloads/flashplayer10_square.html
    Jim

  • Can't pass parameter from HTML form of multipart/form-dta type to JSP

    I am using request.getParameter(passed variable name) to pass data from HTML form to JSP with no problem. WHen I try to pass data from HTML form of multipart/form-dta type to JSP as following:
    < form enctype="multipart/form-data" name="theForm" method="post" ACTION="http://titan.ssd.loral.com:7778/ifs/jsp-bin/ifs-cts/stringsecond.jsp">
    The passed value is null. Why?
    How can I pass data successfully from this form to JSP?
    How can I pass data from JavaScript to JSP?
    Thank you

    I am using request.getParameter(passed variable name)
    to pass data from HTML form to JSP with no problem.
    WHen I try to pass data from HTML form of
    multipart/form-dta type to JSP as following:
    < form enctype="multipart/form-data" name="theForm"
    method="post"
    ACTION="http://titan.ssd.loral.com:7778/ifs/jsp-bin/if
    -cts/stringsecond.jsp">
    The passed value is null. Why?because the jsp most likely does not handling of POST parameters like this.
    How can I pass data successfully from this form to
    JSP?jsp's are not meant to read such amounts of data. this (= uploading) is a typical task for a specialized servlet. there you have full control over input and output. if you need to, you can still forward to a jsp after processing in the servlet.
    How can I pass data from JavaScript to JSP???? i'm not sure what exactly you mean. normally you put it into an url and submit it.
    robert

  • How to fill out POST HTML forms from my Java Application?

    Hi -
    I am writing a little Java GUI program that will allow a user to fill out data from the GUI and then submit that data. When they submit the data (two text fields) I want to take the two text fields and submit them via the POST form method of a HTML document over the web.
    Here is what I got so far:
    host = new URL("http", "<my_address>", web port, "/query.html");
                InputStream in = host.openStream();
                BufferedInputStream bufIn = new BufferedInputStream(in);
                for (;;)
                    int data = bufIn.read();
                    // Check for end of file
                    if (data == -1)
                        break;
                    else
                        System.out.print ( (char) data);
                }What that code does is makes a URL, opens a stream, and reads the HTML source of the file at the specified URL. There is a form that submits data via the POST method, and I would like to know how to write data to specific forms and specific input types of that form.
    Then, I'd like to be able to read the response I get after submitting the form.
    Is this possible?
    Thanks,

    Here is how one of my e-books go about Posting
    I tryied in one of my projects and it works ok
    (Tricks of the Java Programming Gurus)
    There's another reason you may want to manipulate a URLConnection object directly: You may want to post data to a URL, rather than just fetching a document. Web browsers do this with data from online forms, and your applets might use the same mechanism to return data to the server after giving the user a chance to supply information.
    As of this writing, posting is only supported to HTTP URLs. This interface will likely be enhanced in the future-the HTTP protocol supports two ways of sending data to a URL ("post" and "put"), while FTP, for example, supports only one. Currently, the Java library sidesteps the issue, supporting just one method ("post"). Eventually, some mechanism will be needed to enable applets to exert more control over how URLConnection objects are used for output.
    To prepare a URL for output, you first create the URL object just as you would if you were retrieving a document. Then, after gaining access to the URLConnection object, you indicate that you intend to use the connection for output using the setDoOutput method:
    URL gather = new URL("http://www.foo.com/cgi-bin/gather.cgi");
    URLConnection c = gather.openConnection();
    c.setDoOutput(true); Once you finish the preparation, you can get the output stream for the connection, write your data to it, and you're done:
    DataOutputStream out = new DataOutputStream(c.getOutputStream());
    out.writeBytes("name=Bloggs%2C+Joe+David&favoritecolor=blue");
    out.close();
    //MY COMMENT
    //This part can be improved using the URLEncoder
    //******************************************************You might be wondering why the data in the example looks so ugly. That's a good question, and the answer has to do with the limitation mentioned previously: Using URL objects for output is only supported for the HTTP protocol. To be more accurate, version 1.0 of the Java library really only supports output-mode URL objects for posting forms data using HTTP.
    For mostly historical reasons, HTTP forms data is returned to the server in an encoded format, where spaces are changed to plus signs (+), line delimiters to ampersands (&), and various other "special" characters are changed to three-letter escape sequences. The original data for the previous example, before encoding, was the following:
    name=Bloggs, Joe David
    favoritecolor=blue If you know enough about HTTP that you are curious about the details of what actually gets sent to the HTTP server, here's a transcript of what might be sent to www.foo.com if the example code listed previously were compiled into an application and executed:
    POST /cgi-bin/gather.cgi HTTP/1.0
    User-Agent: Java1.0
    Referer: http://www.foo.com/cgi-bin/gather.cgi
    Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
    Content-type: application/x-www-form-urlencoded
    Content-length: 43name=Bloggs%2C+Joe+David&favoritecolor=blue
    Java takes care of building and sending all those protocol headers for you, including the Content-length header, which it calculates automatically. The reason you currently can send only forms data is that the Java library assumes that's all you will want to send. When you use an HTTP URL object for output, the Java library always labels the data you send as encoded form data.
    Once you send the forms data, how do you read the resulting output from the server? The URLConnection class is designed so that you can use an instance for both output and input. It defaults to input-only, and if you turn on output mode without explicitly setting input mode as well, input mode is turned off. If you do both explicitly, however, you can both read and write using a URLConnection:
    c.setDoOutput(true);
    c.setDoInput(true); The only unfortunate thing is that, although URLConnection was designed to make such things possible, version 1.0 of the Java library doesn't support them properly. As of this writing, a bug in the library prevents you from using a single HTTP URLConnection for both input and output.
    //MY COMMENTS
    When you doing URL encoding
    you should not encode it as one string becouse then it will encode the '=' signes and '&' signes also
    you should encode all the field names and values seperatly and then join them using '&'s and '='s
    Ex:-
    public static void addField(StringBuffer sb,String name, String value){
       if (sb.length()>0){
          sb.append("&");
       sb.append(URLEncoder.encode(name,"UTF-8"));
       sb.append("=");
       sb.append(URLEncoder.encode(value,"UTF-8"));
    }

Maybe you are looking for