• Post Reply Bookmark Topic Watch Topic
  • New Topic

how to do this with hashtable  RSS feed

 
kesava chaitanya
Ranch Hand
Posts: 140
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have one urgent requirement in our project
we have of list of requisitions in the page listing ;we will have check boxes to that
say if i check 5 requisitions
we will update the status(statuses like pending,processing,rejecting,invalidate)
when user select reject status we have to send email notification to those users who created those requisitions;when i click update button

I will get userid and requistionid;

if we put in hashtable
userid will come in duplicated but requistionid is unique.
say data wil come like this;

ht.put("Vikram",1313);
ht.put("Shekar",1513);
ht.put("Shekar",4213);
ht.put("Vikram",4613);
ht.put("Vikram",4583);
ht.put("Ranga",4183);
...........
dont tell me that compare with userid.equals("Vikram");
i cant compare like that because i dont know which user can come from database
how to do this with Hashtable;IS ANY OTHER WAY.

i want to send one email to user vikram with requistionids 1313,4613,4583

bye
chaitanya
[ February 17, 2004: Message edited by: Bear Bibeault ]
 
Prakash Dwivedi
Ranch Hand
Posts: 452
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello,
ur hashtable structure was strange??
you should be using keys like USER_ID etc
hashTable.put("USER_ID","Vikram");
hashTable.put("REQUISITION_ID",1313);
Second create different HashTable for different requisition, so the key wont be duplicate.
Put all the HashTables in one ArrayList.
 
kesava chaitanya
Ranch Hand
Posts: 140
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
how requistions ids will go into the vikram(userid i will not hard code ;if userid eqauls to vikram the requistion id should go this userid;
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66307
152
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not a JSP question, so I'm moving this along to the Java in General(intermediate) forum.
 
Wayne L Johnson
Ranch Hand
Posts: 399
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You probably want the user the "UserID" as the hashtable key, and the value will be a List (ArrayList) of "RequisitionID".

When you are done you have a HashTable (ht) where the keys are the user IDs, and the value associated with each key is an ArrayList of his/her requisition IDs. You can easily iterate over each key and pull out the associated ArrayList of requisitions.
In this example I pulled the RequsitionID out as a String since you can't put primitives (such as "int") in an ArrayList. [Yes, I know about auto-boxing in JDK 1.5 ...]
[ February 18, 2004: Message edited by: Wayne L Johnson ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!