Hi,

I have a problem with applet to servlet communication. I am getting
access denied (java.net.SocketPermission) exception when I run the applet
from my windows 95 machine. But the same works fine on an NT machine. The
web server I have is Netscape enterprise server 3.6 on another NT machine.

The exception is thrown when it tries to create ObjectOutputStream.  (Method
writeValues() in the code)
This is my applet code:

public void actionPerformed(ActionEvent ae){

        Values values = new Values();

        values.addValue(mgmt_id.getText());
        values.addValue(mgmt_level.getText());
        values.addValue(mgmt_area.getText());
        values.addValue(org_head.getText());
        values.addValue(mgmt_name.getText());
        values.addValue(rept_to_id.getText());
        values.addValue(repts_to_level.getText());
        values.addValue(hotline_phone.getText());
        values.addValue(comments.getText());

   try{
        URL url = new
URL("http://nsant.bell-atl.com/servlet_Eoc/dataentry_servlet");

        URLConnection con = url.openConnection();
        writeValues(con, values);

        Values response_values = readValues(con);
        if ( response_values != null ) {
             ResultArea.setText((sb.append(response_values.getStatus()
       + "\n")).toString());
            }
        else {
             ResultArea.setText((sb.append("readObject failed
          \n")).toString());
        }
        }
        catch (MalformedURLException mue) {
                ResultArea.setText((sb.append(mue.getMessage() +
"\n")).toString());
        }
        catch (Exception e) {
                ResultArea.setText((sb.append(e.getMessage() +
"\n")).toString());
        }

public void writeValues(URLConnection con, Values value) {
        try {
            con.setUseCaches(false);
            con.setRequestProperty("Content-Type",
"application/x-www-form-urlencoded");
            con.setDoInput(true);
            con.setDoOutput(true);

            ObjectOutputStream os =
              new ObjectOutputStream(con.getOutputStream());

            os.writeObject(value);
            os.flush();
            os.close();
            }
        catch (IOException e) {
                ResultArea.setText((sb.append(e.getMessage()
+"\n")).toString());
        }
       catch (Exception ex){
            ResultArea.setText((sb.append(ex.getMessage() +
"\n")).toString());
       }
  }

Thanks in advance
Divya

______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to