File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes Transferring data between two lists Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Transferring data between two lists" Watch "Transferring data between two lists" New topic

Transferring data between two lists

Kalichar Rangantittu
Ranch Hand

Joined: Jan 15, 2002
Posts: 240
I have a JSP where in I would like to transfer the contents of one list to another via a button.

Source List Target List
------------ ------------
Foo Bar
Test Add Bar 2
Test 2 Rem Bar 3
Test 4 Bar 4

I am hoping to use dispatch action and JSP to get this to work. Does anyone have a sample JSP and/or suggestions on the best way to accomplish this?


Never be satisfied with anything less than the best and you will surely pass the test...
Jason Cox
Ranch Hand

Joined: Jan 21, 2004
Posts: 287
Would this be two lists inside of a form on the page? Is the output text, a select field, a textbox?

I'm not sure I completely understand the question. There are many ways to share information between two lists on a page, but it largely depends on the context you plan on sharing them.

I am assuming the actual information comes from the back-end as well.
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
If you're transferring options from one select box to the other, I'd suggest using JavaScript.

This link shows a demo of this and allows you to download the JavaScript code.

Consultant, Sima Solutions
Kalichar Rangantittu
Ranch Hand

Joined: Jan 15, 2002
Posts: 240
Sorry about the delay. Yes the actual information comes from the back end.
So we would have two lists, one list of currently assigned items and a second list of items that can be assigned. I want to be able to transfer between one list to another. I am aware that this can be done using javascript. Was checking if someone has implemented where clicking on Add takes one to the Action class and returns?
I agree. Here's the link:
subject: Transferring data between two lists
It's not a secret anymore!