Assuming http://wthompson:8080/servlet/Servlet05 is a valid servlet url
(To check that http://wthompson:8080/servlet/Servlet05 is a valid
servlet url, just enter that url into a browser. If the url is valid,
the browser will get the response and display it.)
And assuming servlet Servlet05 implements doGet
And assuming doGet does not need any parameters from the request
Then the code you need can be found at the Java Tutorial
http://java.sun.com/docs/books/tutorial/networking/urls/readingWriting.html
Here is the basic code from the tutorial:
URL dataURL = new URL("http://wthompson:8080/servlet/Servlet05");
URLConnection connection = dataURL.openConnection();
BufferedReader in = new BufferedReader(new
InputStreamReader(connection.getInputStream()));
String line = null;
while((line = in.readLine()) != null)
{
t.append(line).append("\n");
}
Willard Thompson wrote:
>
> Hello -
>
> I get an error while trying to have my applet talk to my servlet. When ever
> I run the simple code below:
>
> ////////////////////////////////////////////////////////////////////////////
> ///////////////
>
> public void actionPerformed(ActionEvent event)
> {
> try
> {
> URL dataURL = new
> URL("http://wthompson:8080/servlet/Servlet05");
> URLConnection connection = dataURL.openConnection();
>
> connection.setUseCaches(false);
> connection.setRequestProperty("Content-Length", "10");
>
> BufferedReader in = new BufferedReader(new
> InputStreamReader(connection.getInputStream()));
>
> String line;
>
> while((line = in.readLine()) != null)
> {
> t.append(line + "\n");
> }
> }
> catch (IOException ioe)
> {
> t.append("IOException: " + ioe);
> }
> }
>
> ////////////////////////////////////////////////////////////////////////////
> ///////////////
>
> I get the following error: "IOException: java.io.FileNotFoundException:
> wthompson:8080//servlet/Servlet05". I've tried a great many directories. As
> well. There must be something else. Appreciate any help.
___________________________________________________________________________
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