You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by un...@thorstenschaefer.de on 2007/01/14 12:32:04 UTC

BigDecimal in DynaActionForm "" instead of null

Hi,

I have an DynaActionForm (using Struts 1) with several properties, all of type
String. My business object is typed; one of its properties is a BigDecimal. To
copy form data to the entity, I'm using BeanUtils.copyProperties. This works
well, but in case of BigDecimals, there is a conversion error because the form
returns an empty string instead of null. I tried to set the "convertNull"
parameter of the ActionServlet, but this didn't change the behavior. Now I have
a workaround (setting the form properties manually to null before using
BeanUtils), but I do not consider this the best solution. Is there a better
solution for this issue?

Cheers,

Thorsten


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: BigDecimal in DynaActionForm "" instead of null

Posted by Martin Gainty <mg...@hotmail.com>.
Thorsten-

inside struts-config.xml you should see a xml configuration file identified from 'value' attribute for the plug-in for your ContextLoaderPlugIn class
  <plug-in className="org.springframework.web.struts.ContextLoaderPlugIn">
    <set-property property="contextConfigLocation"
      value="/WEB-INF/applicationContext-phys-web.xml classpath:/applicationContext-phys-service.xml"/>
  </plug-in>
edit the xml identified in the value attribute
search on lazy-init

  <bean id="syncMedRecWebServicesPortType"
    class="org.springframework.remoting.jaxrpc.JaxRpcPortProxyFactoryBean"
    lazy-init="true">

change to lazy-init="false" save and redeploy the webapp

Anyone else?

Viel Gluck!
Martin --
--------------------------------------------------------------------------- 
This e-mail message (including attachments, if any) is intended for the use of the individual or entity to which it is addressed and may contain information that is privileged, proprietary , confidential and exempt from disclosure. If you are not the intended recipient, you are notified that any dissemination, distribution or copying of this communication is strictly prohibited.
--------------------------------------------------------------------------- 
Le présent message électronique (y compris les pièces qui y sont annexées, le cas échéant) s'adresse au destinataire indiqué et peut contenir des renseignements de caractère privé ou confidentiel. Si vous n'êtes pas le destinataire de ce document, nous vous signalons qu'il est strictement interdit de le diffuser, de le distribuer ou de le reproduire.
----- Original Message ----- 
From: <un...@thorstenschaefer.de>
To: <us...@struts.apache.org>
Sent: Sunday, January 14, 2007 6:32 AM
Subject: BigDecimal in DynaActionForm "" instead of null


> Hi,
> 
> I have an DynaActionForm (using Struts 1) with several properties, all of type
> String. My business object is typed; one of its properties is a BigDecimal. To
> copy form data to the entity, I'm using BeanUtils.copyProperties. This works
> well, but in case of BigDecimals, there is a conversion error because the form
> returns an empty string instead of null. I tried to set the "convertNull"
> parameter of the ActionServlet, but this didn't change the behavior. Now I have
> a workaround (setting the form properties manually to null before using
> BeanUtils), but I do not consider this the best solution. Is there a better
> solution for this issue?
> 
> Cheers,
> 
> Thorsten
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
>