Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
The moose likes JSP and the fly likes Error in hashtable put method Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Error in hashtable put method" Watch "Error in hashtable put method" New topic

Error in hashtable put method

Prem kris

Joined: Jul 16, 2009
Posts: 4
Hi folks,

this is the code I've given in a java class, which is fetching values from a jsp page

infoList.put("compname",request.getParameter("companyname")); // this is the part i'm getting errors

where infoList is a Hashtable object which is declared like "Hashtable infoList = new Hashtable();"

Can someone tell me a solution to solve this ?

Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63353

Do you not think that showing us the error might be useful?

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 13018
I hereby bet that the error is a NullPointerException due to the fact that Hashtable does not allow null keys or values.

A wise programmer would verify that the code

is not returning null.

I agree. Here's the link:
subject: Error in hashtable put method
It's not a secret anymore!