aspose file tools*
The moose likes JSP and the fly likes Hashtable's java. lang. NullPointerException Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Hashtable Watch "Hashtable New topic
Author

Hashtable's java. lang. NullPointerException

simplex du
Greenhorn

Joined: Mar 25, 2002
Posts: 24
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)
then show me the Exception --java.lang.NullPointerException
Nandkishore Dhilde
Greenhorn

Joined: May 09, 2002
Posts: 20
In jsp using usebean u create instance of shopcart
<jsp:useBean id = "shopBean" class="shopCart" />
then use like this
shopBean.insCartItem("12345678",2);


SCJP1.4 certified, IBM SOA Solution Designer[2007]
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

Please don't post the same question in multiple forums, we just end up having the same conversation multiple times.
This question is covered in the JiG (intermediate) Forum here
Dave
Maulin Vasavada
Ranch Hand

Joined: Nov 04, 2001
Posts: 1871
hi
read my reply at the original post page...
here
-maulin
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Hashtable's java. lang. NullPointerException
 
Similar Threads
ObjectOutputStream not working
Hashtable's java. lang. NullPointerException
BMP -last inserted record alone gets fetched
Please tell I'm doing something wrong and ejbs don't suck that much
&#12304;help&#12305;lookup Error