| Author |
Iterator
|
sudhir pavan
Greenhorn
Joined: Sep 01, 2011
Posts: 21
|
|
I have problem in displaying two list values in jsp using struts.
I have two list values
list 1
no name
1 ss
2 dd
list 2
no product name
1 mine ss
2 temp ss
3 disk dd
using iterator i need to display the elements in the below format
name ss
count 2
1 mine
2 temp
name dd
count 1
1 disk
|
 |
Sandy Chatterjee
Ranch Hand
Joined: Jun 27, 2012
Posts: 55
|
|
Even I had the same problem.
Just have a look at the thread : How can I call the Action class inside <logic:iterator> tag in struts 1.3
If you write a code as follows:
If an action could be fired in line 2 then it performs the business logic and retrieves each 'product' from List2 object with 'name' passed as request parameter.
But this is not possible with struts1(As I was informed in the forum).
|
Take up one idea. Make that one idea your life; dream of it; think of it; live on that idea. Let the brain, the body, muscles, nerves, every part of your body be full of that idea, and just leave every other idea alone. This is the way to success.
|
 |
Sandy Chatterjee
Ranch Hand
Joined: Jun 27, 2012
Posts: 55
|
|
The other way is to use an array of List. Sort of 2D array. List2 in your case.
The first row will contain two List2 objects(i.e [1,mine,ss] and [2,temp,ss]).
The second row will contain one List2 object(i.e [3,disk,dd]) and so on.
Try this and tell me if it works.
Also visit my thread and comment on it as somebody has tried his best to help me.
|
 |
Shankar Tanikella
Ranch Hand
Joined: Jan 30, 2011
Posts: 329
|
|
Looks like the data structure being used has a problem.
I would actually prefer to have something like below
Category List (ss/dd)
|
|->(each category has a) Product List (mine/temp/disk)
Anybody to oppose?
Also see if the database has integrity constraint for these two tables. If yes, there should be a definite problem!!
Anyways,
|
Have Fun with Java
little,little.. little by little makes a lot..
|
 |
 |
|
|
subject: Iterator
|
|
|