0

i've a POJO class with primitive types, but when the values are show in the JSF page, they appears to be filled by ZERO.

i think about construct an alternative GETTER method, returning String type with empty value.

But, i can associate an alternative getter in JSF page? because we have 2 versions of same get and set method.

Cœur
  • 37,241
  • 25
  • 195
  • 267
Cleiton Ribeiro
  • 359
  • 2
  • 5
  • 16
  • 1
    Why don't you change your primitive to it's respective object wrapper? – Unknown Apr 25 '16 at 16:06
  • i didn't understand your suggestion :/ – Cleiton Ribeiro Apr 25 '16 at 16:08
  • 1
    Refer this (https://docs.oracle.com/javase/tutorial/java/data/autoboxing.html) – Unknown Apr 25 '16 at 16:10
  • i'm confused yet... because, all my form inputs are associated with some bean property. Like where the framework can understand that he needs to acess through default getter. But i can't use some String.valueOf('') inside my input value... right? – Cleiton Ribeiro Apr 25 '16 at 16:17
  • 3
    If your beanProperty is 'int' then its default value is zero (default value of int is 0). If it is wrapper class Integer as then it's default value is null; – Unknown Apr 25 '16 at 16:20
  • i can understand... but, i can't imagine how can i put this solution in the code. The POJO are used by many other functionalities, i'm trying to not prejudice the rest of the team. I imagine, this solution is located inside my getter, right? – Cleiton Ribeiro Apr 25 '16 at 16:22
  • 1
    For now you try this . But I suggest you to modify int to its wrapper class. It would be nice if you provide little code. – Unknown Apr 25 '16 at 16:36
  • 1
    Also have a look int this. http://stackoverflow.com/questions/3116517/hinputtext-which-is-bound-to-integer-property-is-submitting-value-0-instead-of – Unknown Apr 25 '16 at 16:43

0 Answers0