I am sorry for the previous post(Image did not get uploaded)..I tried to delete that post but i could not do that...
Here i am again posting freshly..
I started reading HFSJ but i stuck at the page number 84.In this page there is a code for
servlet version two and the code is like this
code:
package com.example.web;
import com.example.model.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.util.*;
public class BeerSelect extends HttpServlet
{
public void doPost(HttpServletRequest req,HttpServletResponse res)throws IOException,ServletException
{
res.setContentType("text/html");
PrintWriter out = res.getWriter();
out.println("Beer Selection Advice<br>");
String c= req.getParameter("color");
BeerExpert be = new BeerExpert();
List result = be.getBrands(c);
Iterator it = result.iterator();
while(it.hasNext())
{
out.println("<b> try :"+it.next());
}
}
};
My folder structure is likie
D:\SCWCD Practice\MyProjects\beerv1
In Beerv1 folder structure is like
classes\com\example\web\BeerSelect.class (This is the Action servlet)
and
classes\com\example\model\BeerExpert.class (This is the Model class)
and the
java files are in the following directories
beerv1\src\com\example\model\BeerExpert.java (Java file for Model class)
and
beerv1\src\com\example\web\BeerSelect.java (Java file for Action servlet)
I am following the same path as it is mentioned in the HFSJ book page no 72 1nd 73
The problem i am facing is
D:\SCWCD Practice\MyProjects\beerv1\classes>javac -d classes BeerSelect.java
BeerSelect.java:3: package com.example.model does not exist
import com.example.model.*;
^
BeerSelect.java:18: cannot find symbol
symbol : class BeerExpert
location: class com.example.web.BeerSelect
BeerExpert be = new BeerExpert();
^
BeerSelect.java:18: cannot find symbol
symbol : class BeerExpert
location: class com.example.web.BeerSelect
BeerExpert be = new BeerExpert();
^
3 errors
I think there is a problem with the package structure Please solve my problem..
The Action servlet is under one directory structure and Model class what i am trying to import is in another diretory structure.