cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kirchhoff, Lars" <Lars.Kirchh...@wincor-nixdorf.com>
Subject AW: XMLForm: dynamic content listbox
Date Fri, 22 Nov 2002 08:59:17 GMT
thanks Josema, 

after playing a while I found it as well, but still find it a bit 
confusing, because there is now direct reference. What I did was
the following:

<!-- ========== code ========== -->
     public UserBean () {
        initCustomers();
     }

     public String[] getName() {
        return names;
     }
	  
     public void setName( String[] newNames ) {
        names = newNames;
     }  
    
     public Set getCustomerNames() {
        return customerNames.entrySet();
     }

     public void initCustomers() {
        names          = new String[] {};
        customerNames  = new HashMap();

        ... 
          fill with database entries
        ...
     }
<!-- ========== /code ========== -->

after this was done in the java bean, I could acces the elements 
by using /name as ref value in the xml file.

<!-- ========== code ========== -->
     <xf:selectMany ref="/name" selectUIType="checkbox">
      <xf:caption>Customer</xf:caption>
      <xf:itemset nodeset="customerNames">
       <xf:caption ref="value"/>
       <xf:value ref="key"/>
      </xf:itemset>
     </xf:selectMany>
<!-- ========== /code ========== -->

So, but how is the xmlform framework determining the name?

best regards
Lars Kirchhoff

> -----Urspr√ľngliche Nachricht-----
> Von: Josema Alonso [mailto:alonso@aafunky.com]
> Gesendet: Freitag, 22. November 2002 16:39
> An: cocoon-users@xml.apache.org
> Betreff: RE: XMLForm: dynamic content listbox
> 
> 
> Hi,
> 
> For what I know, the access to the properties by JXPath 
> relies on the getter
> and setter methods. So if you read the code in UserBean.java 
> you'll see:
>   public String[] getHobby()
>   {
>     return hobbies;
>   }
> 
>   public void setHobby( String[] newHobbies )
>   {
>     hobbies = newHobbies;
>   }
> 
> And that's why is accesssed via /hobby.
> 
> Please, Ivelin or anyone else, correct me if I'm wrong.
> 
> Hope it helps.
> 
> 
> -----Mensaje original-----
> De: Kirchhoff, Lars [mailto:Lars.Kirchhoff@wincor-nixdorf.com]
> Enviado el: viernes, 22 de noviembre de 2002 7:20
> Para: 'cocoon-users@xml.apache.org'
> Asunto: AW: XMLForm: dynamic content listbox
> 
> 
> Hello,
> 
> I'm trying the same and did manage to create a dynamic list
> of checkboxes from a database. But I still don't get it completely.
> Where is the ref="/hobby" defined? I looked in the UserBean and the
> userIdentity.xml, but found nothing. Can somebody give me a hint.
> I would like to change this to one of my own variable names.
> 
> regards Lars
> 
> 
> 
> ---------------------------------------------------------------------
> Please check that your question  has not already been answered in the
> FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>
> 
> To unsubscribe, e-mail:     <cocoon-users-unsubscribe@xml.apache.org>
> For additional commands, e-mail:   <cocoon-users-help@xml.apache.org>
> 

---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <cocoon-users-unsubscribe@xml.apache.org>
For additional commands, e-mail:   <cocoon-users-help@xml.apache.org>


Mime
View raw message