Help get this topic noticed by sharing it on Twitter, Facebook, or email.

I have a problem of working with servlet

I am learning servlets through O'Reilly book. In that example i am getting an error which i am not able to resolve it. The servlet name specified in the book is BeerSelect(i am using CoffeeSelect) in the beginning of 3rd chapter. At first it is compiled well.But once i imported the package: import com.example.model, it says: package com.example.model doesnt exist. Also it says CoffeeExpert ce =new CoffeeExpert(); cannot find symbol. If i compile another java ie CoffeeExpert it compile but it gives warning as: src\com\example\model\CoffeeExpert.java used unchecked or unsafe operations. Recompile with -Xlint:unchecked for details. Will you please help me to resolve this? Expecting your reply.
Thanks in Advance
Kalpana.S
1 person has
this problem
+1
Reply
  • Hi Kalpana,

    The key here is that you don't import packages, you import classes.
    The book actually says

    import com.example.model.*;

    The .* is very important note.

    However, you may want to review the chapter, Java projects require careful attention to file placement. Anything in the com.example.model project must be on the filesystem in that same order
    /com/example/model

    http://www.oreilly.com/catalog/978059...
    Head First Servlets and JSP, 2E
    Passing the Sun Certified Web Component Developer Exam
    By Bryan Basham, Kathy Sierra, Bert Bates
    ISBN 13: 9780596516680

    Regards,
    Mace Bergmann -- mace@oreilly.com
    O'Reilly Media Inc.-- http://www.oreilly.com
    1-800-998-9938
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. indifferent, undecided, unconcerned happy, confident, thankful, excited kidding, amused, unsure, silly sad, anxious, confused, frustrated