Hello,

After joining the mailing list today, I found out that I had posted the an
e-mail to the wrong group (developers as opposed to users) so I am posting
here in hopes of getting help on the following:

I am trying to create an HTML form like so: 
Item1Label       Item1Textbox 
Item2Label       Item2Textbox 
Item3Label       Item3Textbox 

What is new to me is the fact that in this case, the number of items
vary and the item labels vary. 

I can display the page fine with the populated values for edit but when
I try to do a save, I get the following struts exception: 
javax.servlet.ServletException:BeanUtils.populate at
org.apache.struts.util.RequestUtils.populate RequestUtils.java:1254) at
org.apache.struts.action.RequestProcessor.processPopulate(RequestProcess
or.java:821) at
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:
254) at
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482) 

I have traced the struts code and see the generic exception being wrapped in
RequestUtils and don't know how to get more debugging information out of
this exception short of taking the struts source, marking it up and then
repackaging it.  I would like to avoid this.

It seems to be having trouble activating my setter in my form but not
sure why. I think because I have setup something improperly in my bean/form
but don't know
what.

Any assistance will be appreciated since this is day 3 of me trying to
figure this out, I am getting a little frustrated.

Thanks,

Katie Wright

The following is pruned version of the code:

JSP:

<html:form action="/jsp/protected/ItemFormSave.do">
<table border="0" cellpadding="0" cellspacing="0">
                <nested:iterate property="itemList">
                    <tr>
                       <td class="contents" width="200">
                           <nested:hidden property="name" />
                           <b><nested:write property="name" /></b>&nbsp;
                       </td>
                       <td width="250">
                           <nested:text property="description" size="50"
maxlength="256"/>
                       </td>
                    </tr>
                </nested:iterate>
</table>
</html:form>

Form:

class ItemBeanFactory implements Factory {
    public ItemBeanFactory() {
    }
    public Object create() {
        return new ItemBean();
    }
}


public  final class ItemForm extends CommonDTOForm {
    private Collection _itemList = new ArrayList();
    public ItemForm() {
        try {
            this._itemList = ListUtils.lazyList(new ArrayList(), new
ItemBeanFactory());
        } catch (Exception e) {
        }
    }
    public void setItemList(Collection list) {
       this._itemList = ListUtils.lazyList((ArrayList) list, new
ItemBeanFactory());
    }
    public Collection getItemList() {
        return (this._itemList) ;
    }
    public void reset(ActionMapping mapping, HttpServletRequest request) {
        super.reset(mapping,request);
        this._itemList = new ArrayList();
    }

    public ActionErrors validate(ActionMapping mapping,
                HttpServletRequest request) {
        ActionErrors errors = super.validate(mapping, request);
        return errors;
    }
}

Bean:

public  final class ItemBean {
    private String _name = null;
    private String _description = null;

    public void setName(String name) {
        this._name=name;
    }

    public String getName() {
        return (this._name) ;
    }

    public void setDescription(String desc) {
        this._description=desc;
    }

    public String getDescription() {
        return (this._description) ;
    }
}



 

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

Reply via email to