• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

Regarding vector

 
Ranch Hand
Posts: 140
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is the java type (class) of your "data"?
You may need to implement its equals and hashCode methods.
 
Atul Mishra
Ranch Hand
Posts: 140
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Its an object,

public class data {
}

with different variables.
 
Kevin Huang
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You do need to implement (override) equals and hashCode method then.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!