Hi,

I believe you need to read the following link 
http://www.jajakarta.org/struts/struts1.1/documentation/ja/target/userGuide/
printer/struts-html.html#options

This should give you an idea of what the attributes of html:options are.
Collection should be a set of java beans. Rules are clearly provided in the
above link.

I can give you an example using <html:optionsCollection>


 <html:form action="Roles" method="post">
  <table border="0" align="center" width="100%">
  <tr>
  <td>
        <bean:message key="app.roleselection"/>
  </td>
  </tr>
  <tr>
        <td align="center">     
         <html:select style="width:180px" size="8" property="strRoleId">
                <html:optionsCollection property="htUserRoles"
label="strDisplayName" value="strId"/>
         </html:select>
        </td>
   </tr>
  </table>
<html:submit/>
</html:form>

Regards, 
Sanoj Antony 


-----Original Message-----
From: Christian Schlaefcke [mailto:[EMAIL PROTECTED]
Sent: Tuesday, March 23, 2004 4:15 PM
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]

Reply via email to