Siva Surya Kumar V <[EMAIL PROTECTED]>@java.sun.com> on 11/16/99
08:14:55 AM
Please respond to Siva Surya Kumar <[EMAIL PROTECTED]>
Sent by: "A mailing list for discussion about Sun Microsystem's Java
Servlet API Technology." <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
cc:
Subject: Calling servlet from a servlet...
HI...
How can i call a servlet from another servlet ???
Thanks in Advance.
- Surya
try to use this one, I'm using and it works!!
String webaddress ="http://127.0.0.1:8080/examples/servlet/<servlet
name>?par1=val1&par2=val2";
InputStream is = null;
try
{
//try to open the HTTP connection with the next ISP specified into the
webaddress value
is = new URL(webaddress).openStream();
}
catch(Exception e)
{
//manage the error
return;
}
BufferedReader br = new BufferedReader(new InputStreamReader(is));
try
{
String nextLine;
nextLine = br.readLine();
while (nextLine != null)
{
System.out.println(nextLine);
nextLine=br.readLine();
}
}
catch(Exception e)
{
System.err.println("Unable to read from InputStream instance");
return;
}
try
{
if (is != null)
is.close();
}
catch(Exception e)
{
System.err.println("Unable to close InputStream instance");
}
}
Antonio Mancuso
___________________________________________________________________________
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