Inside the struts-exercise-taglib.war that comes with struts 1.1 you will
find a pratical example to solve your problem...

You should not do a logic:iterate inside html:select, insteat of
logic:iterate use the option:optionsCollection and pass your collection to
it...

look the jsp example ....

  Vector options = new Vector();
  options.add(new LabelValueBean("Label 0", "Value 0"));
  options.add(new LabelValueBean("Label 1", "Value 1"));
  options.add(new LabelValueBean("Label 2", "Value 2"));
  options.add(new LabelValueBean("Label 3", "Value 3"));
  options.add(new LabelValueBean("Label 4", "Value 4"));
  options.add(new LabelValueBean("Label 5", "Value 5"));
  options.add(new LabelValueBean("Label 6", "Value 6"));
  options.add(new LabelValueBean("Label 7", "Value 7"));
  options.add(new LabelValueBean("Label 8", "Value 8"));
  options.add(new LabelValueBean("Label 9", "Value 9"));
  pageContext.setAttribute("options", options);


      <html:select property="collectionSelect" size="10" multiple="true">
        <html:options collection="options" property="value"
labelProperty="label"/>
      </html:select>

or 

<jsp:useBean id="testbean" scope="session"
class="org.apache.struts.webapp.exercise.TestBean"/>

      <html:select property="beanCollectionSelect" size="10"
multiple="true">
        <html:optionsCollection name="testbean" property="beanCollection"/>
      </html:select>


Tiago Henrique C. R. Alves

-----Mensagem original-----
De: Marco Mistroni [mailto:[EMAIL PROTECTED]
Enviada em: segunda-feira, 15 de dezembro de 2003 10:00
Para: 'Struts Users Mailing List'
Assunto: html:select tag or logic:iterate


Hi all,
        I am quite new to struts tag library and I need an advice.
In the HttpSession I have an object of type Collection, which stores
a list of MyObject.
MyOBject has two properties, description and id.

Out of this Collection of MyObject I must generate a selectable list
Which displays MyObject names,  (wity MyObject.id as value)

I have tried to embed the html:select inside a logic:iterate, but my
editor (websphere studio)complaints for following code

<html:select property="defaultContainerType" multiple="no">
  <logic:iterate collection="<%=
(Collection)session.getAttribute("CONTAINER_TYPES")%>" id="container">
      <html:option value="<bean:write name="container"
property="type"/>">
                        <bean:write name="container"
property="description"/>
        </html:option>
  </logic:iterate>
</html:select>

the error is  'Attribute container has no value'

anyone has a suggestion on how to solve my problem?

Fact is that the Collection is stored in the session, not in a
JavaBean..

Thanks and regards
        marco




---------------------------------------------------------------------
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