this is my code,a shopcart bean example;
import java.util.*;
public class shopCart
{
private Hashtable hashCart;
public void shopCart()
{
try
{
hashCart = new Hashtable();
System.out.println("initializing....");
}
catch(Exception ex)
{
System.out.println(ex.toString());
}
}
public void insCartItem(String merchNo,int merchNum)//
{
System.out.println("yaya");
try
{
hashCart.put("merchNo"+merchNo,merchNo);
hashCart.put("merchNum"+merchNo,new Integer(merchNum));
}
catch(Exception ex)
{
System.out.println(ex.toString());
}
}
}
i use this bean in a
jsp file.
Hashtable shopBean=new shopCart();
shopBean.insCartItem("12345678",2)