Originally posted by Pranit Saha:
I'm using Blazix.. in classes the bean files r placed..
The thing is i've made two classes User and Login.. i place the classes inside classes\jsp folder.. so i write at top of both of the files as
package jsp;
the prob is:
in Login class i want to make an object of User class as
User user=new User();
when compiling it says package jsp not found..
pls tell me do i need to configue my server for this..
u can say from Tomcat and JavaWebServer point of view as well..
Thanks in advn..
Pranit..
Originally posted by Pranit Saha:
Hi George,
Thanks for ur reply.. but my prob hasn't been solved yet.. i'm attaching my two java files.. Item.java and Catalog.java.. i've placed it in WEB-INF\classes.. after compilation of Item.java, Catalog.java gives 14 errors.. as class Jsp.Item not found.. Jsp is a folder i made in WEB-INF\classes\Jsp..
Item.java
==========
package Jsp;
public class Item
{
private String itemId;
private float price;
private String description;
private boolean available;
private int quantity_in_stock;
public Item(String itemId,String description, float price, boolean available,int quantity_in_stock)
{
this.itemId = itemId;
this.description = description;
this.price = price;
this.available = available;
this.quantity_in_stock = quantity_in_stock;
}
public String getItemId()
{
return itemId;
}
public void setItemId(String aItemId)
{
itemId = aItemId;
}
public float getPrice()
{
return price;
}
public String getDescription()
{
return description;
}
public boolean getAvailable()
{
return available;
}
public void setAvailable(boolean aAvailable)
{
available = aAvailable;
}
public int getQuantity_in_stock()
{
return quantity_in_stock;
}
public void setQuantity_in_stock(int aQuantity_in_stock)
{
quantity_in_stock = aQuantity_in_stock;
}
}
Catalog.java
=============
package Jsp;
import java.util.Vector;
public class Catalog
{
private Vector items = new Vector();
synchronized public Vector getItems(String itemId)
{
return items;
}
synchronized public Item getItem(String itemId)
{
int index = Integer.parseInt(itemId);
return (Item)items.elementAt(index);
}
synchronized public void setItem(Item item, String itemId)
{
int index= Integer.parseInt(itemId);
items.set(index,item);
}
public Catalog()
{
/*
* This could be the place for some JDBC code to connect and retrieve
* inventory information, create Item objects and store them here
*/
items.addElement(new Jsp.Item("0","ToothBrush",(float)10,true,100));
items.addElement(new Jsp.Item("1","Comb",(float)1, true,100));
items.addElement(new Item("2","Razor",(float)13,true,1000));
items.addElement(new Item("3","After Shave",(float)10,true,900));
items.addElement(new Item("4","Cologne",(float)25,true,133));
items.addElement(new Item("5","Shaving Cream",(float)12,true,353));
items.addElement(new Item("6","Razor Blades",(float)9,true,333));
items.addElement(new Item("7","Pen Stand",(float)0.99,true,222));
items.addElement(new Item("8","Duke benbie",(float)19,true,343));
items.addElement(new Item("9","Elec Razor",(float)100,true,884));
}
}
Pranit..
Did you see how Paul cut 87% off of his electric heat bill with 82 watts of micro heaters? |