am trying to POST the contacts from a mobile phone to the server database....
This is what i tried: i called the (HttpConnection)Connector.open(url); before the while loop then included the Http method POST after this i implemented the while loop but there is an exception saying no more outputStream available..
this a code fragment of the test i did in place of the contacts:

please check it and tell me whats wrong or if there is another way to go about this? thank you
private void process(){
 
        String mobileNo = textField.getString().trim();
       String lastName = null, firstName = null, otherNames = null, phoneNo1 = null;
 
       // String url = "http://41.73.128.204:8080/ContactServer/ContactServlet";  
         String url = "http://localhost:8084/ContactServer/ContactServlet";
        try
        {
 
                hc = ( HttpConnection )Connector.open( url );
 
 
                hc.setRequestMethod( HttpConnection.POST );
 
 
                int count = 0;
                while ( count < 3 )
                {                       
 
                      lastName = "Omoraro" + count + 2;
                      firstName = "John" + count;
                      otherNames = "Seun" + count;
                      phoneNo1 = "08106900300" + count;
 
              String parameter = "phoneid=" + mobileNo + "&lastname=" + lastName + "&firstname=" + firstName 
                + "&othernames=" + otherNames + "&phoneno1=" + phoneNo1;
 
 
            hc.setRequestProperty( "Content-Type", "application/x-www-form-urlencoded ");
            hc.setRequestProperty( "Content-Length", Integer.toString( parameter.length() ) );
 
            dos = hc.openDataOutputStream();
 
            dos.write( parameter.getBytes() );
 
            lastName = null;
            firstName = null;
            otherNames = null;
            phoneNo1 = null;
 
            System.out.println(count);
            count++;
 
           }//end while
 
            dis = hc.openDataInputStream();
            int length = (int)hc.getLength();
            byte[] data = new byte[length];
 
 
            dis.readFully( data, 0, length );
 
            response = new String( data );
 
            System.out.println(response);
 
 
        }//end try
 
        catch(IOException e){
        e.printStackTrace();
        }
 
        finally
        {
            try
            {
                if ( dis != null )
                    dis.close();
                if ( dos != null )
                    dos.close();
                if ( hc != null )
                    hc.close();
            }//end try
            catch( IOException e ){
                e.printStackTrace();
            }
        }