Why not use xf:itemset in this case instead of jx:forEach?

Giacomo Pati wrote:

On Thu, 21 Aug 2003, Chris Clark wrote:



I think there may be a bug then...

When I try to use a String array in my Java class, I get the following error:

Exception trying to set value with xpath validchecks; Cannot modify property: elrsproto.FormBean.validchecks; Cannot convert value of class java.lang.String to type class [Ljava.lang.String;; Cannot convert class java.lang.String to class [Ljava.lang.String;

That's why I tried to use just a straight String. And it works, except that it only gets the value of the first check.

Whether I use the nodeset or not, I get the same behaviour.

I did verify that I don't need to use the nodeset if I specify all of the controls ahead of time in the form definition. Thanks.

For now my work-around is to use a javascript array object for the form and then copy it into my Java class. That works. Odd.



Ok, let check:


We use a Java Bean that has a:

private String [] m_roles;

which gets initialized with an array from a database and the array size
fits the numbers of item we've stored in the database (even a
'm_roles = new String[ 0 ]' works for us).

with setter/getter

   public void setRoless( String [] roles )
   {
       m_roles = roles;
   }
   public String [] getRoless(  )
   {
       return m_roles;
   }

and the form snipped we use look like:

   <xf:select ref="/roless" appearance="full">
     <xf:label><i18n:text>ROLE</i18n:text></xf:label>
     <jx:forEach var="role" items="${allRoles}">
       <xf:item>
         <xf:label>${role.name}</xf:label>
         <xf:value>${role.name}</xf:value>
       </xf:item>
     </jx:forEach>
   </xf:select>

Hope this helps.

--
Giacomo Pati
Otego AG, Switzerland - http://www.otego.com
Orixo, the XML business alliance - http://www.orixo.com








Reply via email to