File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes HFSJ- Chap 3 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "HFSJ- Chap 3" Watch "HFSJ- Chap 3" New topic
Author

HFSJ- Chap 3

Nilesh Raje
Ranch Hand

Joined: Aug 02, 2005
Posts: 153
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..!


Thanks and Regards,<br />Nilesh<br />SCJP 1.4, SCWCD 1.4
Mat Williams
Ranch Hand

Joined: Jul 20, 2005
Posts: 215
Hi Nilesh,

I think that you are having the same problem as Satish Kesiboyana.
See this thread. Post back if I am wrong or that doesn't solve the problem.

Mat
Rohan Kayan
Ranch Hand

Joined: Sep 17, 2004
Posts: 123
Hi Nilesh ,
I think you have to set the classpath=C:\SCWCD-CX310081\MyProjects\beerv1\src\ . To solve this problem.


Rohan


SCWCD 1.4, SCJP 1.4
Nilesh Raje
Ranch Hand

Joined: Aug 02, 2005
Posts: 153
Yes thanks a ton for your help..!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: HFSJ- Chap 3