• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

Refresh problem with JSPs

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
On my JSP page I have a table that displays previous purchases (that are stored in an array list). Next to each purchase there is a "Remove" link. This link forwards to an initialising action class with the parameter ?Remove=<index>.
The item is then removed from the array list and the JSP is redisplayed.
This is all very well - the problem come in if you have removed an item from the list, come back to the JSP page and hit "Refresh". If you hit refresh another item is removed (from the same index as previously specified). How do I stop this happening??
Thanks,
Julia
 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Don't use the index number to remove, use item/product no, to remove the object.
 
Julia Collins
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That might work - but because it is not a conventional shopping cart (it contains Network Links) there is no unique identifier, aside from a combination of the type of link and the IP Address. If I pass both of these and the index that should work.
I will give this a go - but if anyone knows of another way to do this please spill the beans.
Thank you!
 
Ranch Hand
Posts: 645
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Julia,
Is it possible to replace productid by some value say -1 when some product is removed from array list.
eg if product with id 55 in array at index 10 is removed then just replace 55 with -1 at index 10
so when refresh is hit again -1 will be replaced by -1
cheers
 
We find this kind of rampant individuality very disturbing. But not this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic