Cannot fing the javax.servlet.*; package
[nobr]Hi everybody.. I am new to J2EE Programming.. I just wrote a very small and simple Servlet to see how it works.. The Servlet is designed to take in the the name and a favourite color of a user via a HTML page and display it to him
Here is the code:
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
publicclass VerifyDataextends HttpServlet
{
publicvoid doGet (HttpServletRequest reg, HttpServletResponse res)throws ServletException, IOException
{
res.setContentType("text/html");
PrintWriter out = res.getWriter();
String name= req.getParameter ("name");
String color=req.getParameter ("color");
out.println("<html>");
out.println("<head>");
out.println("<title>Simple HTML Form</title>");
out.println("<link rel='styleSheet' type='text/css' href='examples.css'>");
out.println("</head>");
out.println("<body>");
out.println("<h1>Hello "+name+" Your favourite Color is : " +color+"</h1>");
out.println("<form method='GET' action='verifydata'>");
out.println(" Please Type in your name here:
out.println("<input type='text' name='name'>");
out.println(" Now select the color of your choice
out.println("<select name='color' size='1'>");
out.println("<option>red<option>green<option>blue</select>");
out.println("<br></br>");
out.println("<input type='submit'>");
out.println("<br></br>");
out.println("<table>");
out.println("<tr><th>Colors</th><th>Description</th></tr>");
out.println("<tr><td>Red</td><td>Blood</td></tr>");
out.println("<tr><td>Green</td><td>Grass</td></tr>");
out.println("<tr><td>Blue</td><td>Sky</td></tr>");
out.println("</table>");
out.println("</form>");
out.println("</body>");
out.println("</html>");
}
}
BUT I got the following Error:
C:\Sun\AppServer\jdk\bin>javac VerifyData.java
VerifyData.java:2:package javax.servlet does not exist
import javax.servlet.*;
^
VerifyData.java:3:package javax.servlet.http does not exist
import javax.servlet.http.*;
^
VerifyData.java:5: cannot find symbol
symbol:class HttpServlet
publicclass VerifyDataextends HttpServlet
^
VerifyData.java:7: cannot find symbol
symbol :class HttpServletRequest
location:class VerifyData
publicvoid doGet (HttpServletRequest reg, HttpServletResponse res) thro
ws ServletException, IOException
^
VerifyData.java:7: cannot find symbol
symbol :class HttpServletResponse
location:class VerifyData
publicvoid doGet (HttpServletRequest reg, HttpServletResponse res) thro
ws ServletException, IOException
^
VerifyData.java:7: cannot find symbol
symbol :class ServletException
location:class VerifyData
publicvoid doGet (HttpServletRequest reg, HttpServletResponse res) thro
ws ServletException, IOException
^
VerifyData.java:11: cannot find symbol
symbol : variable req
location:class VerifyData
String name= req.getParameter ("name");
^
VerifyData.java:12: cannot find symbol
symbol : variable req
location:class VerifyData
String color=req.getParameter ("color");
^
8 errors
C:\Sun\AppServer\jdk\bin>
Please please please help me out. I am not sure about the class path settings etc.. but its like this C:\Sun\AppServer\jdk\lib\tools.jar[/nobr]

