Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

implementing multiple view feature  RSS feed

 
Brian Wheeler
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • 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!
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 37180
515
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • 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.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66141
141
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Or, employ on-demand fetching using Ajax.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!