Mike,

When you use form-property with a form-bean, don't you need to make the main
Bean a DynaActionForm or a class you extended from DynaActionForm?  Where do
you initialize the form-property "bean".  For DynaActionForms, they
initialize to null, per "If you do not supply an initial attribute, numbers
will be initialized to 0 and objects to null" from the document:
http://jakarta.apache.org/struts/userGuide/building_controller.html#dyna_act
ion_form_classes

Regards,
David

-----Original Message-----
From: Mu Mike [mailto:[EMAIL PROTECTED]
Sent: Wednesday, March 10, 2004 8:31 PM
To: [EMAIL PROTECTED]
Subject: help me with using bean


I have files like the below,I m  trying to submit a bean object to my
action class, yet when I pressed the "submit" on the jsp file,it threw an
exception:java.lang.IllegalArgumentException: No bean specified

what is the correct way?
Thanks&Regards


myjsp.jsp
========
html:form action="/selectFont.do" >
    <tr>
    <td>
      <html:text property="bean.size" value="10"/>
    </td>
    <td>
      <html:text property="bean.fontName" value="aria"/>
    </td>
    </tr>
    <input type="submit"/>
</html:form>

=========
part of struts-config.xml

        <form-beans>
        <form-bean name="SelectFontForm"
            type="com.viador.rv.form.SelectFontForm">
            <form-property name="bean"
                           type="com.viador.rv.bean.FontBean"/>
        </form-bean>
         </form-beans>

        <action-mappings>
        <action path="/selectFont"
            type="com.viador.rv.action.ApplyFormatAction"
            name="SelectFontForm"
            scope="session">
        </action>
       </action-mappings>

===========
SelectFontForm.java

import org.apache.struts.action.ActionForm;
import com.viador.rv.bean.FontBean;

public class SelectFontForm extends ActionForm{
    public FontBean getBean() {
        return bean;
    }

    public void setBean(FontBean bean) {
        this.bean = bean;
    }

    private FontBean bean;
}

==========
FontBean.java

public class FontBean  {
    public int getSize() {
        return size;
    }

    public void setSize(int size) {
        this.size = size;
    }

    public String getFontName() {
        return fontName;
    }

    public void setFontName(String fontName) {
        this.fontName = fontName;
    }

    private int size;
    private String fontName;

}

_________________________________________________________________
享用世界上最大的电子邮件系统― MSN Hotmail。  http://www.hotmail.com


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


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

Reply via email to