hehe... no just practicing things on my own.
going through the Head First book and trying to improve my skills in Servlets and
JSP's
i'm presently facing a new issue....
This is the BeerServlet code
package com.example.web;
import com.example.model.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.util.*;
public class BeerServlet extends HttpServlet
{
public void doPost(HttpServletRequest request, HttpServletResponse response)throws IOException
{
BeerExpert be = new BeerExpert();
String str = request.getParameter("color");
List result = be.getResult(str);
response.setContentType("text/html");
PrintWriter out = response.getWriter();
out.println("Beer Selection Advice <br>");
//out.println("<br>Got Beer Color: " + str);
out.print("Values Retrieved: ");
Iterator it = result.iterator();
while(it.hasNext())
{
String s1 = (String) it.next();
out.print(" "+s1);
}
}
}
and below is the BeerExpert code
package com.example.model;
import java.util.*;
public class BeerExpert
{
public List getResult(String value)
{
List al = new ArrayList();
if(value.equals("amber"))
{
al.add("amber");
al.add("found");
}
else
{
al.add("amber");
al.add("not found");
}
return al;
}
}
when i'm executing the folowing command
C:\Documents and Settings\dodo\My Documents\MyProject\beerV1>javac -classpath D:\tomcat\common\lib\servlet-api.jar;classes:. -d classes src/com/example/web/BeerServlet.java
i'm getting the following error
src\com\example\web\BeerServlet.java:3: package com.example.model does not exist
import com.example.model.*;
^
src\com\example\web\BeerServlet.java:15: cannot find symbol
symbol : class BeerExpert
location: class com.example.web.BeerServlet
BeerExpert be = new BeerExpert();
^
src\com\example\web\BeerServlet.java:15: cannot find symbol
symbol : class BeerExpert
location: class com.example.web.BeerServlet
BeerExpert be = new BeerExpert();
^
3 errors
the packages have been named but some how its not able to identify the package...