Hi all,
I have a doubt and I think the answer is very simple.
I want to call a servlet from an applet with the method post in order to
send an object to the servlet, and I want the servlet responds whith an HTML
page. This page will show in the browser where the applet is.
the source maybe like this :
In the applet :
...
URL myUrl = new URL ("http://myserver:8080/servlet/myservlet");
URLConnection con = myUrl.openConnection ();
con.setDoInput (true);
con.setDoOutput (true);
con.setUseCaches (false);
con.setDefaultUseCaches (false);
con.setRequestProperty ("Content-type", "application/octet-stream");
ObjectOutputStream out = new ObjectOutputStream (con.getOutputStream
());
out.writeObject (myObject);
out.close ();
...
In the servlet :
public void doPost (HttpServletRequest request, HttpServletResponse
response) {
ObjectInputStream in = new ObjectInputStream (request.getInputStream
());
ObjectOutputStream out = new ObjectOutputStream
(response.getOutputStream ());
SBSRequest sbsRequest = (SBSRequest)in.readObject ();
in.close ();
response.setContentType ("text/html");
PrintWriter out = response.getWriter ();
out.println ("<html>");
out. ...
out.println ("</html>");
out.close ();
}
I tried this but the browser does not show the html page. Someone has done
this before ?
Thanks in advance,
Juan Jose Martin
___________________________________________________________________________
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