• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

implementing multiple view feature

 
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello World,

I'm trying to implement a multiple view/delete feature. I have two arraylist. One holds (javabean)car information such as unique id, year, make, and model. Another arraylist that holds another arraylist of (javabean) which it holds history and unique id of the vehicle. On the jsp, there is an input form that searches for a vehicle by unique id. If there is a match it adds to the arraylist. I want to provide a list of clickable tabs or buttons where each button clicked shows information about one unique vehicle or delete that view(ex. user searches for 3 cars. Arraylist then has three entries. There should be three different buttons for each unique entry in the arraylist).

I'm pretty close to having it working. I'm currently iterating through arraylist and using javascript to hide all the views except the one picked. When the user clicks on the a delete button, it goes to the action class and removes the corresponding index that is clicked. But its not working because the index of the button clicked isn't passing the right index to the action class.

Anyways, I want to see how others would implement this. And also see if someone can show me how I can pass the right index when a button is clicked.

Cheers!
 
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Brian,
The two main ways to implement would be JSP (only sending the HTML for the right views) or JavaScript (hiding as you did.) I would choose JavaScript as well providing there are only a few cars. If someplace like the police department was using the system and there were hundreds of cars, I would hide on the JSP level.

As far as your JavaScript error, sharing some code (and the error message) would be helpful.
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Or, employ on-demand fetching using Ajax.
reply
    Bookmark Topic Watch Topic
  • New Topic