[Logo] Enterprise Client Community
  [Search] Search   [Recent Topics] Recent Topics   [Members]  Member Listing   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
t:field problem with null Objects and e.g. BigDecimal  XML
Forum Index -> Development
Author Message
wocher

Power User
[Avatar]

Joined: 14/04/2008 13:10:19
Messages: 49
Location: Ravensburg
Offline

We have a problem with a field with a e.g. BigDecimal or Integer.
When the field is set in the bean the chanced value from the ui will successful write into the bean.
When the property in the bean null the ui make a string and give this to the BeanWrapper. ( Controls with the debugger

<t:field id="g_227" attributemacro="BeanWrapper()" reference="expression:#{d.AbholAuftrag.data.abholAuftragWrapper.lademeter}" width="30" />

public java.math.BigDecimal lademeter = null;


„Ein Haus ohne Bücher ist arm, auch wenn schöne Teppiche seinen Boden und kostbare Tapeten und Bilder die Wände bedecken.“
Hermann Hesse, Dichter, Schriftsteller und Maler * 02. 07. 1877 - Calw † 09. 08. 1962 - Montagnola, Schweiz

Rainer Wocher Quentia Development GmbH (Sotware Developer)
[ICQ]
CaptainCasa

Power User
[Avatar]

Joined: 21/11/2007 12:23:06
Messages: 5528
Offline

Hi,

there is no change to bypass this behaviour, because you use the FIELD (and not FORMATTEDFIELD).

The problem is: the client passes a string "1234", the server now passes this into the application. While passing it tries to find out the best fittin data type. The sequence is:

(1.) If the property is a set/get property, then "Yippieh!" - the data type of the property is defined by the program.

(2.) If the property is a dynamic one, behin a Map implementation, then it is a bit more difficult:
(a.) if there is already a value in the Map, then "Yippieh!" again - the data type of this existing element is the driving one
(b.) if there is no value in the Map, then this data type is chosen which fits best to the component; e.g. if it is a CALENDARFIELD, then a Date is chosen, etc. for FORMATTEDFIELD. For FIELD components there is no data type association behind... - so the last option (c.) is chosen.
(c.) the data is passed into the Map as String

So, this explains the behaviour you describe.

Björn

Björn Müller, CaptainCasa GmbH
CaptainCasa

Power User
[Avatar]

Joined: 21/11/2007 12:23:06
Messages: 5528
Offline

Sorry, I forgot to write, what you can do:

(1.) Use FORMATTEFIELD with proper data type definition.
or
(2.) Apply a server side data type conversion

Hope this helps!

Björn

Björn Müller, CaptainCasa GmbH
CaptainCasa

Power User
[Avatar]

Joined: 21/11/2007 12:23:06
Messages: 5528
Offline

Update 20081215 contains a furhter improvement: interface IPropertyValueConverter - this interface is called prior to passing the value - please check the JavaDoc of the interface.

Björn

Björn Müller, CaptainCasa GmbH
wocher

Power User
[Avatar]

Joined: 14/04/2008 13:10:19
Messages: 49
Location: Ravensburg
Offline

Thanks for this feature.
It fix the problem with this problem.

Good work!

Greet Wocher

„Ein Haus ohne Bücher ist arm, auch wenn schöne Teppiche seinen Boden und kostbare Tapeten und Bilder die Wände bedecken.“
Hermann Hesse, Dichter, Schriftsteller und Maler * 02. 07. 1877 - Calw † 09. 08. 1962 - Montagnola, Schweiz

Rainer Wocher Quentia Development GmbH (Sotware Developer)
[ICQ]
 
Forum Index -> Development
Go to:   
Powered by JForum 2.1.6 © JForum Team