struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark <markl...@libero.it>
Subject Re: use logic:Iterate display multi-record from the database
Date Wed, 18 Dec 2002 10:37:25 GMT

I have a question and its similar to the original one here:

I've written some classes that return hashmaps, i'm currently instantiating
my beans in my jsp's using useBean .. I want to use the struts bean tags but
this can wait...

I'd prefer to have my collections available to sitebuilders in more elegant
way, but the only way i've found of doing this is by having a liststuff
action which i'm not very keen on becuase this isn't very friendly to the
site builder whos busy dealing with client side issues etc, and has his/her
hands full doing this.

Whats the most elegant way of making HashMaps and Arrays etc available to
the iterate tags without too much geeking around.. The other problem i have
with my methodolgy (i.e. Usebean and iterate) is i can't pass my connection
object to my beans.

I basically want to have collections available for sitebuilders to say "i
want this collection here" , i also want to have my collections avaible to
the html:options and select menu thingies , but still have found no elegant
means of doing so. 

I haven't neglected to read the docs, although i could be guilty of not
understanding them.

If its usful to anyone i've been using the following

///
Package com.acme;

public class CompaniesList {


public HashMap getCompanies ()
    {
    
            HashMap companies = new HashMap();
        
            try
            {
                put some stuff in my companies hashmap , i've been doing
this via sql query hence SQLException

            }
            catch (SQLException e)
            {
                e.printStackTrace();
            }
            return companies;
        }
}
///
In the jsp:
<jsp:useBean id="cc" class="com.acme.CompaniesList" scope="request"/>

<logic:iterate id="company" name="cc" property="companies">
        <bean:write name="company" property="key"/>|<bean:write
name="company" property="value"/><br />
</logic:iterate>

//

I'm sure i'm missing something, and have need of correction. One of the
attractions of struts was the iterate tags and the select menus iterface for
site builders. But having list actions seems to be the long way around as
well.

Thanks in advance.


On 18-12-2002 10:14, "Roland Carlsson" <roland.c@swetravel.se> wrote:

> In the documentation, there are a list of accepted structures. But
> java.util.Collection with subclasses is a safe bet :-)
> 
> Regards
> Roland
> 
> ----- Original Message -----
> From: "frank" <frank@bleum.com>
> To: "'Struts Users Mailing List'" <struts-user@jakarta.apache.org>
> Sent: Wednesday, December 18, 2002 9:59 AM
> Subject: RE: use logic:Iterate display multi-record from the database
> 
> 
>> Hi, all
>> Thank you for your reply. Please send it me as your wish.
>> I download from the apache's website of the struts and study the
>> example, in its example, they use Hashmap to store the data, but I think
>> it is too complex, maybe can use some other collection structure as
>> Vector.
>> 
>> 
>> 
>> Best regard!
>> 
>> Frank
>> Software Engineer
>> Bleum Incorporated
>> 9E East Building, Hi-Tech King World
>> 668 East Beijing Road.
>> Shanghai, P.R.C.200001
>> Phone: (8621) 5308 1196
>> http:// www.bleum.com
>> 
>> -----Original Message-----
>> From: Jitendra Singh [mailto:jits_1998@hotmail.com]
>> Sent: 2002年12月18日 16:35
>> To: Struts Users Mailing List
>> Subject: Re: use logic:Iterate display multi-record from the database
>> 
>> hi all,
>> I am working on a similar problem with my colleague Murthy.
>> I have made a custom tag that will display a given number of records per
>> page from a table.I beleive this is a common problem and it can be put
>> in
>> the the logic tld or some other where it is appropriate.
>> 
>> But i don' know how to do it...
>> 
>> Please guide me...
>> 
>> frank,
>> If u are intersted tell me i will send u the package .. its for oracle.
>> I
>> hope to complete it by enveing.
>> 
>> cheers!
>> Jitendra
>> 
>> 
>> ----- Original Message -----
>> From: "frank" <frank@bleum.com>
>> To: <struts-user@jakarta.apache.org>
>> Sent: Wednesday, December 18, 2002 1:47 PM
>> Subject: use logic:Iterate display multi-record from the database
>> 
>> 
>>> Hi, all
>>> I'm a new of struts.
>>> I want to use logic:Iterate to display the multi-record from the
>>> database, and for each record I use a bean to store as showdata. The
>>> total data are stored in the groupshowdata.
>>> Can I use the logic:Iterate taglib? Can someone give some simple
>>> example?
>>> Any help will be welcome.
>>> 
>>> 
>>> Best regard!
>>> 
>>> Frank
>>> Software Engineer
>>> Bleum Incorporated
>>> 9E East Building, Hi-Tech King World
>>> 668 East Beijing Road.
>>> Shanghai, P.R.C.200001
>>> Phone: (8621) 5308 1196
>>> http:// www.bleum.com
>>> 
>>> 
>> 
>> --
>> To unsubscribe, e-mail:
>> <mailto:struts-user-unsubscribe@jakarta.apache.org>
>> For additional commands, e-mail:
>> <mailto:struts-user-help@jakarta.apache.org>
>> 
>> 
>> 
>> 
>> 
>> --
>> To unsubscribe, e-mail:
> <mailto:struts-user-unsubscribe@jakarta.apache.org>
>> For additional commands, e-mail:
> <mailto:struts-user-help@jakarta.apache.org>
>> 
> 
> 
> --
> To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:struts-user-help@jakarta.apache.org>
> 
> 


--
To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-user-help@jakarta.apache.org>


Mime
View raw message