you have the html:options set correctly in the first example
<html:select property="selectedItem">
 <html:options collection="customers" property="id" labelProperty="name" />
</html:select>


in the second example you changed to:
<html:select property="tumSikayetler">
<html:options collection="sikayetler" value="sikayetKodu" label="sikayet" />
</html:select>

try:
<html:select property="tumSikayetler">
<html:options collection="sikayetler" property="sikayetKodu" labelProperty="sikayet" />
</html:select>



Inactive hide details for EROL TEZCAN <[EMAIL PROTECTED]>EROL TEZCAN <[EMAIL PROTECTED]>


          EROL TEZCAN <[EMAIL PROTECTED]>

          07/12/2005 09:38 AM

          Please respond to
          "Struts Users Mailing List" <[email protected]>

To

sturts_apache_user sturts_apache_user <[email protected]>

cc


Subject

html:select Problem !!

Hi all,

I want to set records come from database into a html:select tag. I found some example like below
<html:select property="selectedItem">
 <html:options collection="customers" property="id" labelProperty="name" />
</html:select>

When I set th options as static , the list comes without any problem. But when I create a html:select dynamicly from DB , I get error.

In my Action class, it has a method called getSikayetler() like this.


Sikayet sikayet = null;
ArrayList sikayetler = new ArrayList();

while (rs.next()) {
               sikayet = new Sikayet();
               sikayet.setSikayetKodu(rs.getString("SIKAYET_KODU"));
               sikayet.setSikayet(rs.getString("ACIKLAMA"));
               sikayetler.add(sikayet);
           }



When I created an ArrayList, I send it to my Action class and in my Action class I set this ArrayList to request like below



ArrayList listeDondur = getSikayetler();

request.setAttribute("sikayetler", listeDondur);



sikayetler ArrayList is not null and empty, I tested it.



How must I use this request object called sikayetler in html:select ?




<html:select property="tumSikayetler">
<html:options collection="sikayetler" value="sikayetKodu" label="sikayet" />
</html:select>




usage of above is wrong?



In Sikayet class there are get and set methods like sikayetKodu and sikayet .



How can I fill html:select tag with records coming from DB?



Any help, sample codes?



Thanks



Erol





---------------------------------
Sell on Yahoo! Auctions  - No fees. Bid on great items.

Reply via email to