This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan 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 Android Security Essentials Live Lessons this week in the Android 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: 12761
    
    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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Compiling Servlets with HTML
 
Similar Threads
Trying to test my first servlet.
tomcat can't find index.jsp
getting error while running servlet in tomcat
Help in compiling Servlet program
I am not able to run JSP and Servlets :(