This week's book giveaway is in the Java in General forum.
We're giving away four copies of Event Streams in Action and have Alexander Dean & Valentin Crettaz on-line!
See this thread for details.
Win a copy of Event Streams in Action this week in the Java in General forum!
  • 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
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Knute Snortum
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Piet Souris
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

Problem with two "logic:iterate" tags

 
Ranch Hand
Posts: 2908
1
Spring Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ranchers ,

I am using two list one is of "name" and other is of "id" , Now i want this two list to be printed on JSP page simultaneously using "logic:iterate" . like this :

name1 id1
name2 id2
.
.

I.e i want to make something like this .. (for i=0, j=0; i<5; i++,j++) in JSP.

How should I do that,
Please Help !!
 
Ranch Hand
Posts: 341
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's better to have a DVO that has the appropriate mutators for the variables and iterate over it.
 
Sagar Rohankar
Ranch Hand
Posts: 2908
1
Spring Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

It's better to have a DVO


Can you just explain me what is DVO ?? and if you are pointing me towards bean , then is it necessary to add bean object into list and then access it on JSP page thru iterator ??
 
Anubhav Anand
Ranch Hand
Posts: 341
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A DVO is Data Value Object now more commonly known as DTO, a Data Transfer Object. Yes, indeed it is a bean but just a bit special as it is used to transfer object values.

Now, say you have two properties in your bean username and password and as you say you have multiple values for the same. So, indeed you need to bind it in an iteratebale collection and ten use it on your jsp. Precisely maybe an ArrayList of your DVO objects.
 
Ranch Hand
Posts: 884
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

A DVO is Data Value Object now more commonly known as DTO, a Data Transfer Object.


Actually, the widely used name is either Value Object (VO) or Data Transfer Object (DTO). VO is considered as the old name for DTO.
 
Sagar Rohankar
Ranch Hand
Posts: 2908
1
Spring Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the explanation , sir ..
But my real problem is , i don`t want to use bean , because i don`t want make one more java class , which gonna used only once (i.e when user first access it , after that there is no need of it ) . Now, thats mean there is no other way, so that I can access both list simultaneously on JSP page OR i need to use scriptlet <% %> tag (that is java code on JSP , and i also dont prefer that kind of mixing..)

So the bottom line is , i need to used DTO only , thats the ultimate solution , right ??
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!