thats what i thought about the way to write to the files, but i believe that i'm having troubles actually getting to the servlet code.
here is what i have so far...
//*********applet***********/
try
{
URL baseURL = getCodeBase();
String protocol = baseURL.getProtocol();
String host = baseURL.getHost();
int port = 808;
String urlSuffix = "/servlet/contactlist.servletOne";
URL url = new URL(protocol, host, port, urlSuffix);
URLConnection conn = url.openConnection();
// inform the connection that we will send output and accept input
conn.setDoInput(true);
conn.setDoOutput(true);
// Don't use a cached version of URL connection.
conn.setUseCaches (false);
conn.setDefaultUseCaches (false);
InputStream inputStreamFromServlet = conn.getInputStream();
inputStreamFromServlet.read();
inputStreamFromServlet.close();
System.out.println("testing for the end8");
}
catch(IOException io) { io.printStackTrace(); }
//********servlet***********/
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException
{
System.out.println("get");
try
{
FileWriter f = new FileWriter("G:\\Intranet\\wwwroot\\Contact\\contactlist\\Departments\\test.htm");
f.write("testing");
f.flush();
f.close();
}
catch(IOException io) { io.printStackTrace(); }
}
i've never been able to see the "get" in the log.
i check tomcat's localhost_access_log and it tells me this
10.1.2.230 - - [09/Apr/2002:13:59:28 -0500] "GET /servlet/contactlist.servletOne HTTP/1.1" 200 -
this means that i am calling the servlet? doesn't it?
so i'm thinking that the applet and servlet are talking to each other, but i just am not calling the doGet method correctly.
Andy
Yes, it means that tomcat received an HTTP GET request for the "/servlet/contactlist...", and that the URL was found. (200 == OK).
This kind of problems can be somewhat tricky. I suggest:
1) in your servlet, write something to the response - response.getWriter().write("Hi there!")
2) call the servlet from a browser. if you see the message, your servlet is called.
3) If your servlet is not called, tell me what response you get in the browser.
Note that the System.out.println() probably does not write to the standard log - it will most likely either write to the DOS console or to a special system_out log.
ok, i tried to typed in the address of the servlet into my browser
but i just got a blank screen
i didn't get an error, so this means that the file is there.
could this mean that i do not have the proper permissions?
or will typing the address into the browser, not have the same effect as running it through the applet?