| 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.
|
 |
 |
|
|
subject: Regarding vector
|
|
|