Tenho o seguinte codigo:
[color=“blue”]
import javax.servlet.;
import javax.servlet.http.;
import java.io.;
import java.util.;
public class TestingServlet extends HttpServlet{
public static void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException{
PrinterWriter out = response.getWriter();
out.println("<html>");
out.println("<head>");
out.println("<title>Servlet Testing</title>");
out.println("</head>");
out.println("<body>");
out.println("<center>Welcome to the first Servlet Testing Center</center>");
out.println("</body>");
out.println("</html>");
}
}
[/color]
Quando tento compilar ele da o seguinte erro:
[color=“red”]C:\tomcat-5.5.4\jakarta-tomcat-5.5.4\webapps\myApp\WEB-INF\classes\TestingServlet.java:1: package javax.servlet does not exist
import javax.servlet.;
^
C:\tomcat-5.5.4\jakarta-tomcat-5.5.4\webapps\myApp\WEB-INF\classes\TestingServlet.java:2: package javax.servlet.http does not exist
import javax.servlet.http.;
^
C:\tomcat-5.5.4\jakarta-tomcat-5.5.4\webapps\myApp\WEB-INF\classes\TestingServlet.java:6: cannot find symbol
symbol: class HttpServlet
public class TestingServlet extends HttpServlet{
^
C:\tomcat-5.5.4\jakarta-tomcat-5.5.4\webapps\myApp\WEB-INF\classes\TestingServlet.java:7: cannot find symbol
symbol : class HttpServletRequest
location: class TestingServlet
public static void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException{
^
C:\tomcat-5.5.4\jakarta-tomcat-5.5.4\webapps\myApp\WEB-INF\classes\TestingServlet.java:7: cannot find symbol
symbol : class HttpServletResponse
location: class TestingServlet
public static void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException{
^
C:\tomcat-5.5.4\jakarta-tomcat-5.5.4\webapps\myApp\WEB-INF\classes\TestingServlet.java:7: cannot find symbol
symbol : class ServletException
location: class TestingServlet
public static void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException{
^
C:\tomcat-5.5.4\jakarta-tomcat-5.5.4\webapps\myApp\WEB-INF\classes\TestingServlet.java:9: cannot find symbol
symbol : class PrinterWriter
location: class TestingServlet
PrinterWriter out = response.getWriter();
^
7 errors[/color]
Alguém poderia me dar uma ajuda, este é o primeiro exemplo do livro do BUDI