I am trying to run a servlet which reads a text file and outputs its
contents to the HttpServletResponse's PrintWriter using println.
i.e.:
public void doGet(HttpServletRequest req,
HttpServletResponse res)
throws ServletException, IOException
{
res.setContentType("text/html");
PrintWriter toClient = res.getWriter();
//*** code to read file into a string, s, here ***
toClient.println(s);
toClient.close();
return;
}
There is more to my code than just this, but this is the general idea.
The first file which I read in contains:
<html>
<script language=javascript src="/html/javascript/getDate.js"></script>
<script language=javascript
src="/html/javascript/listFunctions.js"></script>
<script language=javascript>
function siteListChanged()
{
// empty out all dialer entries
emptyList(document.scriptForm.streamList)
<--there is more after this which is created in the servlet code-->
When I run the code, I receive the following error. For some reason,
the "/html/javascript/getDate.js" code as a reference to a servlet???
My browser (Netscape) then attempts to start the non-existent servlet
called .../html/javascript/getDate.js
Internal Servlet Error:java.lang.ClassNotFoundException: html
java.lang.ClassNotFoundException: html
at java.lang.Throwable.fillInStackTrace(Native Method)
at java.lang.Throwable.fillInStackTrace(Compiled Code)
at java.lang.Throwable.<init>(Compiled Code)
at java.lang.Exception.<init>(Compiled Code)
at
java.lang.ClassNotFoundException.<init>(ClassNotFoundException.java:6
9)
at
com.sun.tomcat.server.ServletLoader.loadServlet(ServletLoader.java:91
)
at
com.sun.tomcat.server.ServletWrapper.loadServlet(ServletWrapper.java:
65)
at com.sun.tomcat.server.ServletWrapper.handleRequest(Compiled
Code)
at
com.sun.tomcat.server.InvokerServlet.service(InvokerServlet.java:94)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:611)
at com.sun.tomcat.server.ServletWrapper.handleRequest(Compiled
Code)
at com.sun.tomcat.server.Context.handleRequest(Compiled Code)
at com.sun.tomcat.server.ConnectionHandler.run(Compiled Code)
Sent via Deja.com http://www.deja.com/
Before you buy.