I am trying to figure out what happens to the value of my nested checkbox when
I submit my form.
I have a bean:
public class FagDTO {
with setter/getter methods for a boolean:
//for fagtypeform
public void setEkstraTekst ( boolean ekstra_tekst ){
logger.info("setting ekstra tekst to " + ekstra_tekst + " for " +
this.getEkskode());
_ekstra_tekst = ekstra_tekst;
}
public boolean getEkstraTekst (){
return _ekstra_tekst;
}
I have an ActionForm with setters/getters which return a collection of "Fag"
beans (The above "FagDTO" beans are nested one-to-one in the "Fag" beans. Fag
means "class" in Danish BTW):
public class FagTypeForm extends ActionForm {
protected List _fags = new ArrayList();
public void setFags(Fag[] fags) {
for (int i = 0; i < fags.length; i++) {
logger.info("setting fag property " +
fags[i].getFagDetail().getEkstraTekst() + " for fag " +
fags[i].getFagDetail().getNavn());
_fags.add(i, fags[i]);
}
}
public void setFags(int n, Fag fag) {
logger.info("setting fag at " + n);
_fags.add(n, fag);
}
public List getFags() {
return _fags;
}
public void reset(ActionMapping mapping, HttpServletRequest request) {
logger.info("calling reset");
Iterator fagiter = _fags.iterator();
while (fagiter.hasNext()) {
Fag myfag = (Fag)fagiter.next();
FagDTO myfagdetail = myfag.getFagDetail();
myfagdetail.setEkstraTekst(Boolean.FALSE);
}
resetFields();
}
}
Then I have my jsp:
<html:form action="/fagTypeSave">
<!-- cycle over rows of ekskoder -->
<logic:iterate property="fags" name="fagtypeform" id="fager" indexId="indx">
<nested:text indexed="true" name="fager" property="fagDetail.navn" />
<nested:checkbox indexed="true" name="fager" property="fagDetail.ekstraTekst" />
</logic:iterate>
(submit button stuff...)
</html:form>
My html form gets populated from fagtypeform just fine, and reset seems to
work. But when I change some checkbox values and submit, nothing happens. At
least, the setters/getters of my "FagDTO"
bean don't get hit and print out logging stuff, like I had hoped. And the
value in my bean doesn't change.
So my real question is: what is the "property" of nested:checkbox doing? How
can I get nested:checkbox to set the value in my FagDTO when I submit it?
Thanks,
Heather Buch
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]