Folks, I've some major problems regarding
servlets.
I thought i'd give the first few chapters from a book on Servlets I have, a spin. The book's called "Java Servlet Programming Bible".
Anyway, I installed JRun 3.1
And my
IDE is JBuilder 6 Enterprise edition.
Well, JRun is running.
And in JBuilder, I selected to start a new project (servlet), and copy the HelloWorld example from the book.
NOw folks, this is REALLY dumb, i admit, but the program won't compile, even when i've included the servlet.jar file.
The code is below:-
package servletbible.ch06.examples;
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.sql.*;
/**
* Hello World Servlet. Displays "Hello World" in the browser.
*/
public class HelloWorldServlet extends HttpServlet
{
/**
* Here we override the doGet method
*
* @param request the client's request
* @param response the servlet's response
*/
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
{
/**
* Sets the content type
*/
response.setContentType("text/html");
PrintWriter out = response.getWriter();
/**
* Prints the html document and Hello World!
*/
out.println("<html><head><title>Hello World Servlet</title></head><body>");
out.println("<h1>"+getMessage()+"</h1>");
out.println("</body></html>");
out.close();
}
public
String getMessage()
{
return message;
}
} //End of HelloWorldServlet
And the errors I get when I try and compile the code are illustrated below:-
"ServletTemplate.java": Error #: 300 : method getwriter() not found in interface javax.servlet.http.HttpServletResponse at line 9, column 31
"HelloWorldServlet.java": Error #: 300 : variable message not found in class servletbible.ch06.examples.HelloWorldServlet at line 41, column 10
"Servlet1.java": Error #: 901 : package . stated in source E:\Java\Servlets\test\Servlet1.java does not match directory
test Any ideas as to the problems, please, anybody?