To add to that...
I a m running example from Kathy 's
Servlet and
JSP book....chapter 3...
i have following directory structure.
C:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps\Beer-v1\WEB-INF\classes\com\example\model\BeerExpert.java
and
C:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps\Beer-v1\WEB-INF\classes\com\example\web\BeerSelect.java
The source code for BeerSelect is
package com.example.web;
import com.example.model.*;
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.util.*;
public class BeerSelect extends HttpServlet
{
public void doPost(HttpServletRequest req,HttpServletResponse res) throws IOException,ServletException
{
String c=req.getParameter("color");
BeerExpert be=new BeerExpert();
List result=be.getBrands(c);
res.setContentType("text/html");
PrintWriter out=res.getWriter();
out.println("Beer Selection Advice<br>");
Iterator it=result.iterator();
while(it.hasNext())
{
out.println("<br>try: "+it.next());
}
}
}
and source code for BeerExpert is
package com.example.model;
import java.util.*;
public class BeerExpert
{
public List getBrands(String color)
{
List brands=new ArrayList();
if(color.equals("amber"))
{
brands.add("Jack Amber");
brands.add("Red Moose");
}
else
{
brands.add("Jail Pale Ale");
brands.add("Gout Stout");
}
return(brands);
}
}
Beer Expert is compiling fine but whenevr i am running BeerSelect its giving me an error
C:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps\Beer-v1\WEB-INF\classes\com\example\web\BeerSelect.java:2: package com.example.model does not exist
import com.example.model.*;
^
C:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps\Beer-v1\WEB-INF\classes\com\example\web\BeerSelect.java:14: cannot find symbol
symbol : class BeerExpert
location: class com.example.web.BeerSelect
BeerExpert be=new BeerExpert();
^
C:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps\Beer-v1\WEB-INF\classes\com\example\web\BeerSelect.java:14: cannot find symbol
symbol : class BeerExpert
location: class com.example.web.BeerSelect
BeerExpert be=new BeerExpert();
^
3 errors
Tool completed with exit code 1
Can anyone help in this regard
Thanks in advance