Hello Freinds,
I am doing the Mini MVC Tutorial mentioned in HFSJ..!
I have created the 2
java files and the Development architecture is as given in the book
1)C:\SCWCD-CX310081\MyProjects\beerv1\src\com\example\model\BeerExpert.java
2)C:\SCWCD-CX310081\MyProjects\beerv1\src\com\example\web\BeerSelect.java
This is the code I have written for 2 files..!
========================= BeerExpert.java ====================
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("
Rose Amber");}
else{
brands.add(" Jail Pale Ale");
brands.add(" Gout Stout "); }
return(brands);
}
}
==============================================================
================== BeerSelect.java ===========================
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 request, HttpServletResponse response)
throws ServletException, IOException {
String c=request.getParameter("color");
BeerExpert be=new BeerExpert();
List result=be.getBrands(c);
request.setAttribute("styles",result);
RequestDispatcher view=request.getRequestDispatcher("result.jsp");
view.forward(request,response);
}
}
========================================================
This is the error I am getting..!
C:\SCWCD-CX310081\MyProjects\beerv1\src\com\example\web>javac BeerSelect.java
BeerSelect.java:3: package com.example.model does not exist
import com.example.model.*;
^
BeerSelect.java:20: cannot find symbol
symbol : class BeerExpert
location: class com.example.web.BeerSelect
BeerExpert be=new BeerExpert();
^
BeerSelect.java:20: cannot find symbol
symbol : class BeerExpert
location: class com.example.web.BeerSelect
BeerExpert be=new BeerExpert();
^
3 errors
I am not able to solve this prob since one day..! Can any one explain me y is this so ??
Please help me as this is frustrating me now..!