Sneha Sharma@CONTEXT
07/25/2000 01:13 PM
java.net.URL url = null;
try
{
url = new java.net.URL("http://server/cgi-bin/my.pl");
}
catch(java.net.MalformedURLException e)
{
System.out.println(e.toString());
}//try
try
{
java.net.URLConnection conn =
(java.net.URLConnection)url.openConnection();
conn.setDoOutput(true);
conn.setUseCaches(false);
conn.setRequestProperty("content-type","application/x-www-form-urlencoded")
;
java.io.DataOutputStream dos = new
DataOutputStream(conn.getOutputStream());
conn.connect();
String queryString = "name=Sneha&address=123";
dos.writeBytes(queryString);
dos.flush();
dos.close();
System.out.println("Sent the mail");
//Take the output of the script file
java.io.InputStream ins = null;
ins = conn.getInputStream();
String strLine = "";
StringBuffer strbufFileContents = new StringBuffer(0);
if(ins != null)
{
java.io.BufferedReader bufFile = new java.io.BufferedReader(new
java.io.InputStreamReader(ins));
while ((strLine = bufFile.readLine()) != null)
{
strbufFileContents.append(strLine);
}//while
bufFile.close();
out.println(strbufFileContents.toString());
}// if(ins)
}
catch(Exception e1)
{
System.out.println(e1.toString());
}//try
Aparna Neelgar <[EMAIL PROTECTED]> on 07/25/2000 03:31:56 PM
Please respond to A mailing list about Java Server Pages specification and
reference <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
cc: (bcc: Sneha Sharma/Context)
Subject: Servlets question, Urgent!!!!
Hi all,
Is there a way to take the query string parameters to a servlet from
command
line or from a file? Like instead of using a browser, cna the command line
be used to send a query to a servlet which after processing displays a
message in html, jsp or just as a out.println(). If so, please let me know.
Can it be done using the generic servlet?
Thanks in advance.
-Aparna
________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets