aspose file tools*
The moose likes Java in General and the fly likes Regarding vector Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Regarding vector" Watch "Regarding vector" New topic
Author

Regarding vector

Atul Mishra
Ranch Hand

Joined: Jun 08, 2006
Posts: 140
All,

I have a scenario like this:
1. AddValue, adds a new record to the database, and stores the object added, say data in a vector.
Now this vector I put in a request object for displaying in jsp.

2. DeleteValue, deletes a record from database.
Here, the record should be deleted from the database and the same page should be refreshed. Since the page checks for values in the vector, I am trying to remove the element from the vector, the record which is deleted.
But it doesnt remove it.

In my database class, I am doing a select statement first, then creating a data object, returning it, saying this is the object which is being deleted.

In my action class, I have the vector returned from the request scope.

I am trying to remove the object returned from the vector

vector.removeelement(data) // but it returns false. Why ?

any help appreciated.
Kevin Huang
Greenhorn

Joined: Mar 27, 2004
Posts: 13
What is the java type (class) of your "data"?
You may need to implement its equals and hashCode methods.
Atul Mishra
Ranch Hand

Joined: Jun 08, 2006
Posts: 140
Its an object,

public class data {
}

with different variables.
Kevin Huang
Greenhorn

Joined: Mar 27, 2004
Posts: 13
You do need to implement (override) equals and hashCode method then.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Regarding vector
 
Similar Threads
SCJD B&S locking
Associated Disk Space
Gaps in JTable for deleted records?
Action Class or Regular Java Class to use?
Deleted Flag