Monica Kapoor

Greenhorn
+ Follow
since Nov 08, 2005
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Monica Kapoor

Hi Ranchers,
I have a problem, for your info. it from chapter 3 of Head first Servlets and Jsp. I have this Servlet code below and the Model code also below.I have imported the model package in line 2 of servlet code, but when I compile it in Windows XP it says model package does not exit and gives the error message as shown below.Please help.I am a beginner.
Monica


Servlet Code:

package com.example.web;
import com.example.model.*; --- Here I am importing the Package of Model
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;

public class BeerSelect extends HttpServlet{
public void doPost(HttpServletRequest request,HttpServletResponse response)
throws IOException, ServletException{
response.setContentType("text/html");
PrintWriter out = response.getWriter();
out.println("Beer Selectio Advice<br>");
String c= request.getParameter("color");


BeerExpert be = new BeerExpert();
List result= be.getBrands(c);
Iterator it = result.Iterator();
while(it.hasNext())
{
out.print("<br>try: " + it.next());
}
}
}


Error Message:


C:\Documents and Settings\Monica\Desktop\MyProjects\beerV1\src\com\exampl
e\web>javac BeerSelect.java
BeerSelect.java:2: package com.example.model does not exist
import com.example.model.*;
^
BeerSelect.java:17: cannot find symbol
symbol : class BeerExpert
location: class com.example.web.BeerSelect
BeerExpert be = new BeerExpert();
^
BeerSelect.java:17: cannot find symbol
symbol : class BeerExpert
location: class com.example.web.BeerSelect
BeerExpert be = new BeerExpert();
^
BeerSelect.java:19: cannot find symbol
symbol : method Iterator()
location: interface java.util.List
Iterator it = result.Iterator();
^
4 errors

C:\Documents and Settings\Monica\Desktop\MyProjects\beerV1\src\com\exampl
e\web>
[ February 04, 2006: Message edited by: Bear Bibeault ]
18 years ago
Hi Ranchers,
I am trying to install mysql and wanna use it with java.I have installed the server.My problem is what else should I and how I have to install to work with Servlets and JSPs and the Mysql.I have setup of mysql-connector-odbc and mysql-connector-java.Thank you alot guys,regards,
Monica
Thanks Ben for your reply can you please give me an example of it.Did you mean th replace the value of '-d' flag with the destination path.Sorry for not able your answer.
18 years ago
HI I am new to servlets and am reffering Head first for them.In chapter 3 on MVC it creates a servlet.I have kept the servlet java file (named BeerSelect.java) in the following path:

MyProjects/beer1/src/com/example/web/BeerSelect.java

this is the only palse i have kept it.

Now the author asks to compile servlet with the -d flag to put the class in the development enviornment.Using the following the command.

%cd MyProjects/beerV1
%javac -classpath c:/Tomcat 5.5/common/lib/servlet-api.jar:classes:. -d classes src/com/example/web/BeerSelect.java

and it gives me an error

javac: invalid flag: 5.5/common/lib/servlet-api.jar:classes:. -d

please help.

[ January 12, 2006: Message edited by: Bear Bibeault ]
[ January 12, 2006: Message edited by: Bear Bibeault ]
18 years ago
Thanks alot friends for your help .I am going to do as you have advised.Thanks alot.
Monika
18 years ago
Hi friends,
I am a beginner to JSP and Servlets I have downloaded Eclipse and wanna know which is the best server to download for a beginner. Further is head first JSP and Servlets a good book to begin with?Thanks for your support,
Monica.
18 years ago