File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes Problem with two Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Problem with two "logic:iterate" tags " Watch "Problem with two "logic:iterate" tags " New topic
Author

Problem with two "logic:iterate" tags

Sagar Rohankar
Ranch Hand

Joined: Feb 19, 2008
Posts: 2902
    
    1

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 !!


[LEARNING bLOG] | [Freelance Web Designer] | [and "Rohan" is part of my surname]
Anubhav Anand
Ranch Hand

Joined: May 18, 2007
Posts: 341

It's better to have a DVO that has the appropriate mutators for the variables and iterate over it.
Sagar Rohankar
Ranch Hand

Joined: Feb 19, 2008
Posts: 2902
    
    1

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

Joined: May 18, 2007
Posts: 341

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.
Chengwei Lee
Ranch Hand

Joined: Apr 02, 2004
Posts: 884
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.


SCJP 1.4 * SCWCD 1.4 * SCBCD 1.3 * SCJA 1.0 * TOGAF 8
Sagar Rohankar
Ranch Hand

Joined: Feb 19, 2008
Posts: 2902
    
    1

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 ??
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem with two "logic:iterate" tags