Hello, we have a datatable in jsf view, one column is a number in bean. After submiting form (ivy event) we receive initialised number 0, so our validation cannot check if user inserted it manually (field is mandatory, 0 must be explicit inserted). How can we avoid the auto initialisation ?

Karel

asked 03.03.2016 at 08:44

tauser's gravatar image

tauser
11131516
accept rate: 33%

edited 24.05.2016 at 11:11

Reguel%20Wermelinger's gravatar image

Reguel Werme... ♦♦
8.2k21650


Hi, we have found the solution to set up

ivy.vm.additional.options=-Dorg.apache.el.parser.COERCE_TO_ZERO=false

But it must be done in all environments (each server, each designer in Development Team). Is there any possibility to set this in Run time (API ?)

Karel

link
This answer is marked "community wiki".

answered 18.04.2016 at 15:34

tauser's gravatar image

tauser
11131516
accept rate: 33%

cool. the following code should do the same at runtime:

System.setProperty(org.apache.el.parser.COERCE_TO_ZERO, Boolean.False.toString());
(19.04.2016 at 08:41) Reguel Werme... ♦♦ Reguel%20Wermelinger's gravatar image

I think you can determine if the 0 was auto initialized by using the IvyDefaultValues helper:

ch.ivyteam.ivy.scripting.objects.util.IvyDefaultValues.isDefaultObject(Object)

There exists also a community project 'dataclass-nuller' which helps to nullify auto initialized data class values. See https://github.com/ivy-supplements/dataclass-nuller/releases

link

answered 14.03.2016 at 09:32

Reguel%20Wermelinger's gravatar image

Reguel Werme... ♦♦
8.2k21650
accept rate: 68%

edited 15.03.2016 at 14:12

Hi, thank you for your response. This would be great, but isDefaultObject returns false. I think it comes from jsf view already as 0. I have tried p:inputText instead of p:inputNumber, but it is the same.

Karel

(15.03.2016 at 07:25) tauser tauser's gravatar image
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×76
×5
×2

Asked: 03.03.2016 at 08:44

Seen: 1,091 times

Last updated: 24.05.2016 at 11:11