This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes Servlets and the fly likes Compiling Servlets with HTML Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Compiling Servlets with HTML" Watch "Compiling Servlets with HTML" New topic
Author

Compiling Servlets with HTML

Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
I am trying to compile & run the Servlet HelloWWW below. The servlet is placed in C:\Tomcat\jakarta-tomcat\webapps\ROOT\WEB-INF\classes\coreservletsEB-INF\classes .
When i try to compile the HelloWWW3 i get the error message "Class ServletUtilities not found". Any help is apreciated.

import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class HelloWWW extends HttpServlet {
public void doGet(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html");
PrintWriter out = response.getWriter();
out.println(ServletUtilities.headWithTitle("Hello World") +
"<BODY>\n" +
"<H1>Hello WWW</H1>\n" +
"</BODY></HTML>");
}
}
Thanks.
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12769
    
    5
The reason probably is that the ServletUtilities class is not part of the standard library so your import statements are not finding it.
You need to figure out which package ServletUtilities lives in.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Compiling Servlets with HTML