session.setAttribute("myList", list);

session.setAttribute("myList",list.toArray());


for some reason you need to cast to list to an array.


On 24 Mar 2004, at 01:23, Lokanath wrote:


hi ,

i think u have to get the bean from session to some Collection
useing session.getAttribute("mylist") then assign it to some collection.then
use that collection for populating the select


lokee

-----Original Message-----
From: Christian Schlaefcke [mailto:[EMAIL PROTECTED]
Sent: Tuesday, March 23, 2004 2:45 AM
To: Struts Users Mailing List
Subject: html:select / html:options


Hi Folks!


for several days I mess around with html:select and html:options.

I want to access a collection with names or numbers (just
java.lang.String). This collection is available in the session. For
testing I generated my own collection in the jsp

<%
     java.util.Collection list = new java.util.ArrayList();
     teilnehmerListe.add("name1");
     teilnehmerListe.add("name2");
     teilnehmerListe.add("name3");
     session.setAttribute("myList", list);
%>
     <html:form action="/myAction.do">
          <html:select property="selectedItem">
               <html:options collection="myList" />
          </html:select>
          <html:submit>OK</html:submit>
     </html:form>

When I run this I get an IllegalArgumentException: no name specified

I found out that both "select" and "options" have an argument "name" so I
added some dummies "test1" and "test2" just to have it and get (as
expected) another error: no bean found by that name "test1".


What am I doing wrong? Can someone point me to the right direction?

Thanx and Regards,

Chris


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to