On Fri, 5 Jul 2002, Efftinge, Sven wrote:
> Date: Fri, 5 Jul 2002 13:40:46 +0200
> From: "Efftinge, Sven" <[EMAIL PROTECTED]>
> Reply-To: Struts Users Mailing List <[EMAIL PROTECTED]>
> To: 'Struts Users Mailing List' <[EMAIL PROTECTED]>
> Subject: AW: IllegalArgumentException: argument type mismatch
>
> I forgot some Information:
>
> these are the fields of AccountGruppeData :
>
> protected java.lang.Integer id;
> protected java.util.Date datum;
> protected java.lang.Integer accountGruppenArtId;
> protected java.lang.String notiz;
> protected java.lang.String name;
> protected java.lang.String debitorNr;
> protected java.math.BigDecimal mwStInProzent;
> protected java.math.BigDecimal rabattInProzent;
> protected java.math.BigDecimal guthaben;
>
> maybe the BeanUtils have problems with Date or BigDecimal ????
>
In 1.0 and 1.1-beta-1, there are no standard conversions for BigDecimal.
This has been added in the most recent nightly builds (plus the ability to
register your own custom Converter classes -- see the latest javadocs for
the BeanUtils package <http://jakarta.apache.org/commons/beanutils/api/>).
There is still no standard converter for Date (primarily because you
really need to be locale-sensitive for things like that).
However, using data types like BigDecimal (or Integer, or Date) in your
form beans is not generally a good idea -- you're still going to get
conversion errors if the user types something invalid like "1a3" instead
of "123". You should generally use strings in your form beans, and do the
conversion to your real data types later (in the Action, or via a separate
method like getDatumConverted() in the form bean) after validation has
guaranteed that the conversions will be successful.
Craig McClanahan
>
>
> -----Urspr�ngliche Nachricht-----
> Von: Efftinge, Sven [mailto:[EMAIL PROTECTED]]
> Gesendet: Freitag, 5. Juli 2002 13:32
> An: '[EMAIL PROTECTED]'
> Betreff: IllegalArgumentException: argument type mismatch
>
>
> Hi,
> i have an ActionForm wich has only one Attribute. This Attribute is a
> DataObject (a serializable Bean wich presents the Data of an EntityBean).
>
> // ActionForm
>
> public class AccountGruppeForm extends ActionForm {
>
> private AccountGruppeData accountGruppe = new AccountGruppeData();
>
> public AccountGruppeData getAccountGruppe() {
> return this.accountGruppe;
> }
>
> public void setAccountGruppe(AccountGruppeData accountGruppe) {
> this.accountGruppe = accountGruppe;
> }
> }
>
> The Dataobject AccountGruppeData has 9 fields with a getter and a setter
> method.
>
> My Struts-config.xml looks like this (I am using Struts 1.1-b1):
>
> <struts-config>
> <!-- ============ Form-Beans ============================== -->
> <form-beans>
> <form-bean name="AccountGruppeForm"
>
> type="de.lohndirekt.ikarus.web.formbeans.billing.AccountGruppeForm" />
> </form-beans>
>
>
> <!-- ========== Global Forward Definitions ==============================
> -->
> <global-forwards>
> <forward name = "error" path = "/global/error.jsp" />
> </global-forwards>
> <!-- ========== Action Mapping Definitions ==============================
> -->
> <action-mappings>
> <!-- ========== FibuAccountGruppeEditieren
> ============================== -->
> <action path="/billing/FibuAccountGruppeSuchAction"
>
> type="de.lohndirekt.ikarus.web.actions.billing.FibuAccountGruppeSuchAction"
> name="AccountGruppeForm"
> scope="request"
> validate="false" >
>
> <forward name="failure" path="/AccountGruppeSuchFormular.jsp" />
> <forward name="success" path="/FibuAccountGruppeAnsicht.jsp" />
> </action>
>
> <action path="/billing/FibuAccountGruppeUpdateAction"
>
> type="de.lohndirekt.ikarus.web.actions.billing.FibuAccountGruppeUpdateAction
> "
> name="AccountGruppeForm"
> scope="request"
> validate="true" >
>
> <forward name="failure" path="/FibuAccountGruppeAnsicht.jsp" />
> <forward name="success" path="/FibuAccountGruppeAnsicht.jsp" />
> </action>
>
> </action-mappings>
> </struts-config>
>
> My Problem:
> the first Action ("/billing/FibuAccountGruppeSuchAction") works, but when i
> send a request to <html:form
> action="/billing/FibuAccountGruppeUpdateAction"> I get the following:
>
> javax.servlet.ServletException: BeanUtils.populate
> at
> org.apache.struts.util.RequestUtils.populate(RequestUtils.java:954)
> at
> org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.j
> ava:795)
> at
> org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:244)
>
> at
> org.apache.struts.action.ActionServlet.process(ActionServlet.java:1109)
> at
> org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:470) ...
>
> java.lang.IllegalArgumentException: argument type mismatch
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
> )
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
> .java:25)
> at java.lang.reflect.Method.invoke(Method.java:324)
> at
> org.apache.commons.beanutils.PropertyUtils.setSimpleProperty(PropertyUtils.j
> ava:1574)
> at
> org.apache.commons.beanutils.PropertyUtils.setNestedProperty(PropertyUtils.j
> ava:1468)
> at
> org.apache.commons.beanutils.PropertyUtils.setProperty(PropertyUtils.java:14
> 98)
> at
> org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:613)
> at
> org.apache.struts.util.RequestUtils.populate(RequestUtils.java:952)
> at
> org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.j
> ava:795)
> at
> org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:244)
>
> at
> org.apache.struts.action.ActionServlet.process(ActionServlet.java:1109)
> at
> org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:470) ...
>
>
> First I open a formular to search for an AccountGruppe by an Id:
> without formats AccountGruppeSuchFormular.jsp looks like this:
>
> <html:form action="billing/FibuAccountGruppeSuchAction">
> <html:text property="accountGruppe.id"/>
> <html:submit/>
> </html:form>
>
> the ActionServlet fetches the Data of the AccountGruppe from the EJBServer.
> The presentation of the Data is in /FibuAccountGruppeAnsicht.jsp:
>
> <html:form action="billing/FibuAccountGruppeUpdateAction">
> <html:text property="accountGruppe.name"/>
> <html:text property="accountGruppe.notiz"/>
> <html:text property="accountGruppe.guthaben"/>
> <html:text property="accountGruppe.datum"/>
> <html:text property="accountGruppe.mwStInProzent"/>
> <html:text property="accountGruppe.rabattInProzent"/>
> <html:submit/>
> </html:form>
>
> this works all fine, the error apears when i press the submit button.
>
> I have no Idea where the error could be.
> thanks for helping,
> Sven
>
> --
> To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
>
> --
> To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
>
>
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>