You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Karr, David" <Da...@wamu.net> on 2003/03/17 17:26:17 UTC

RE: html-el:select

You said "ContestForm" has a "categories" property.  Your reference in
the JSP says that "ContestForm" has a "map" property, which has a
"categories" property.  Which is it?  If the former, your reference
would just be "${ContestForm.categories}".

> -----Original Message-----
> From: awc [mailto:awc@drytel.net]
> 
> I have a form called ContestForm. It has a Collection called
categories.
> 
> categories is List which holds a instances of class Category. Which
has
> methods getId() and getCatoryName().
> 
> on hrml:el  this does not work...
> 
> I mean I want to populate selected property and the selection list
from
> the same form.
> 
> <html-el:form action="/contest/addcoll">
> 
>      <html-el:select property="categoryId" size="10">
> does not work...
> 1.  --->
>     <html-el:options collection="categories" property="id"
> labelProperty="categoryName"/>
> 
> 2. ---->
>     <html-el:options collection="${ContestForm.map.categories}"
> property="id"
> labelProperty="categoryName"/>
> ---->

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


Re: html-el:select

Posted by awc <aw...@drytel.net>.
Sorry I should have added more info.

ContestForm is DynaValidatorForm and has

<form-property  name="categories"  type="java.util.Collection"/>
<form-property  name="categoryId"  type="java.lang.Integer"/>

if I try

<html-el:options collection="${ContestForm.categories}" property="id"
labelProperty="categoryName"/>

with DynaValidatorForm, it does not work.

.anil

to recap...
struts-config.xml

<form-bean name="ContestForm"
type="org.apache.struts.validator.DynaValidatorForm">
<form-property  name="categories"  type="java.util.Collection"/>
<form-property  name="categoryId"  type="java.lang.Integer"/>
  </form-bean>

jsp...

<html-el:form action="/contest/addcoll">

    <html-el:options collection="${ContestForm.map.categories}"
property="id" labelProperty="categoryName"/>

</html-el:select>
</html-el:form>


categories holds instances of Category class.

class Category {
    public Integer getId(); //and set
    public String getCategoryName(); // and set
}



---> On some other page.. this works ok.. so it is there. I cannot get
this into select...

<logic-el:iterate id="cats" collection="${ContestForm.map.categories}"
indexId="index">

 <tr><td>
  <c:out value="${cats.categoryName}"/>
 </td>
 <td>
 <html-el:link
page="/contest/add.do?col=cat&pindex=${ContestForm.map.index}&index=${cats.index}">Remove</html-el:link>

 <td>
 </tr>

</logic-el:iterate>

.anil


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