• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

Iterator

 
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 55
Mac Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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).


 
Sandy Chatterjee
Ranch Hand
Posts: 55
Mac Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 329
Eclipse IDE Oracle Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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,


 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!