Hi,

I've been trying to send boolean values from a servlet back to an applet,
but I am stuck. I am doing something like this:

public void doPost(HttpServletRequest req, HttpServletResponse resp) throws
ServletException, java.io.IOException
{
  // Get the input stream for reading data from the client
DataInputStream in = new DataInputStream(req.getInputStream());

// We'll be sending binary data back to the client so
// set the content type appropriately
resp.setContentType("application/octet-stream");

// Data will always be written to a byte array buffer so
// that we can tell the client the length of the data
ByteArrayOutputStream byteOut = new ByteArrayOutputStream();

// Create the output stream to be used to write the
// data to our buffer
DataOutputStream out = new DataOutputStream(byteOut);

// Send back a boolean value indicating that the
// user is invalid
if userIsValid(something)
        out.writeBoolean(true);
else
        out.writeBoolean(false);
out.close();
}

-- sometimes I get EOFException, sometimes i get true, but I never get
false back.. the applet uses :

DataInputStream in = new DataInputStream(urlConnection.getInputStream());
boolean value = in.readBoolean();

Can anyone help please?
Nelson

___________________________________________________________________________
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