> I do not want these parameters to show. http://www.google.com/search?q=showDocument+POST&btnG=Google+Search
. Java Tip 34: POSTing via Java http://www.javaworld.com/javaworld/javatips/jw-javatip34.html/ Java Tip 41: POSTing via Java revisited http://www.javaworld.com/javaworld/javatips/jw-javatip41.html. So, just how do we display the results of a POST from an applet? Well, there are four answers to that question. In order of increasing pain, these are: We can't. Don't post. Use a bean. Cheat: 1.The applet POSTs information to the server just as before. 2.The server uses the POST information to generate HTML. 3.The server saves the HTML to a file on the Web server. 4.The server returns a magical key to the applet. 5.The applet encodes the key into a URL back to the server. 6.The applet instructs the browser to display a Web page by using the generated URL in a showDocument() call. 7.The server accepts the GET request and extracts the magic key parameter. 8.The server retrieves the file associated with the magic key. 9.The server returns the HTML contents from the file to the browser. 10.The browser displays the HTML contents. (tip 34 code) /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Copyright (c) Non, Inc. 1997 -- All Rights Reserved PROJECT: JavaWorld MODULE: Web Stuff FILE: Happy.java AUTHOR: John D. Mitchell, Jul 8, 1997 REVISION HISTORY: Name Date Description ---- ---- ----------- JDM 97.07.08 Initial version. DESCRIPTION: This file shows how to POST to a web-server and get back the raw response data. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ import java.awt.*; import java.applet.*; import java.io.*; import java.util.*; import java.net.*; public class Happy extends Applet { private TextArea textArea = new TextArea (25, 70); public void init () { try { URL url; URLConnection urlConn; DataOutputStream printout; DataInputStream input; // URL of CGI-Bin script. url = new URL (getCodeBase().toString() + "env.cgi"); // URL connection channel. urlConn = url.openConnection(); // Let the run-time system (RTS) know that we want input. urlConn.setDoInput (true); // Let the RTS know that we want to do output. urlConn.setDoOutput (true); // No caching, we want the real thing. urlConn.setUseCaches (false); // Specify the content type. urlConn.setRequestProperty ("Content-Type", "application/x-www-form-urlencoded"); // Send POST output. printout = new DataOutputStream (urlConn.getOutputStream ()); String content = "name=" + URLEncoder.encode ("Buford Early") + "&email=" + URLEncoder.encode ("[EMAIL PROTECTED]"); printout.writeBytes (content); printout.flush (); printout.close (); // Get response data. input = new DataInputStream (urlConn.getInputStream ()); String str; while (null != ((str = input.readLine()))) { System.out.println (str); textArea.appendText (str + "\n"); } input.close (); // Display response. add ("Center", textArea); } catch (MalformedURLException me) { System.err.println("MalformedURLException: " + me); } catch (IOException ioe) { System.err.println("IOException: " + ioe.getMessage()); } } // End of method init(). ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm Archives: http://www.mail-archive.com/[email protected]/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
