> -----Message d'origine-----
> De : Gonzalez Comesaña [mailto:Gonzalez Comesaña]
> Envoyé : jeudi 13 novembre 2003 11:36
> À : Struts Users Mailing List
> Objet : Dynamic HTML
> 
> 
> 
> How can generate "input tags"  dynamicly ??  My application
> have fields that are dynamics  and sometimes I have 1 fields 
> and sometimes I have N fields. 
> Can I "control" this in struts ??
> 
> 
> Thanks
> 
> 
> Sergio.


Yes, with indexed or nested properties
Example :

public class InfoForm extends ValidatorForm{    // defined in session
scope in struts config
    Info info;
    public Info getInfo() {
        return info;
    }
    public void setInfo(Info info) {
        this.info = info;
    }  
}
public class Info implements Serializable, GroupByItem {
    ArrayList smsList = new ArrayList();                // the "dynamic"
indexed property
    public ArrayList getSmsList() {
        return this.smsList;
    }
    public void setSmsList(ArrayList newSmsList) {
        this.smsList = newSmsList;
    }
        public void setAddSmsButton(String empty) {
        Sms sms = new Sms();
        this.addSms(sms);
    }
    public void commitSmsDelete() {
        for (int index=0; index<smsList.size(); index++) {
            Sms sms = (Sms)smsList.get(index);
            if (sms.getCheckDeleted() == true) {
                this.removeSms(sms);
            }
        }
    }
    public void addSms(Sms sms){
          this.smsList.add(sms);
    }
}

<nested:nest property="info">
<nested:iterate property="smsList" indexId="index"> 
<nested:submit property="deleteSmsButton"/>                     // on
Sms class there is a boolean property "deleteSmsButton"
</nested:iterate>
<nested:submit property="addSmsButton"/>
</nested:nest> 

Bye 
Franck


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to