Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / April 2008

Tip: Looking for answers? Try searching our database.

Struts logic:iterator for 2d array

Thread view: 
Trevor - 02 Apr 2008 15:51 GMT
Hi,

I am using Struts 1.3 with Hibernate. If I run a simple HQL query in one of
my data access objects (e.g.  "from users as u"), this returns a list to my
actionform which I can iterate through in my jsp as follows:

<logic:iterate id="usersForm" name="usersForm" property="allusers"
scope="request">
      <bean:write name="usersForm" property="firstname"/>
      <bean:write name="usersForm" property="lastname"/>
</logic:iterate>

The above works fine. However when trying to run a query that joins two
tables together (e.g. "from users as u inner join u.addresses as a") this
returns a 2D list in the format:

Element 0
   User
   Address
Element 1
   User
   Address

Which I cannot use in my jsp as the <logic:iterate> is iterating over the
top-level elements and not the user/address objects. I think I need to have
nested <logic:iterate> tags but not sure of the syntax or how this affects
my actionform.

Any help of guidence on this would be very much appreciated.

Thanks
Trev
Danno - 02 Apr 2008 19:17 GMT
> Hi,
>
[quoted text clipped - 28 lines]
> Thanks
> Trev

I don't know how much help you will get, since people have started
using some modern web frameworks, and Struts has also evolved from
1.3.  Try to nest the logic:iterate tags yourself and see if that
works.  You can also look into using JSTL to include in your Struts
package which definitely provides the nesting capability.  If you are
doing a greenfield project then very much consider a modern web
framework like Seam, Grails, Wicket, or Struts 2.0.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.