-
1. Re: Illegal Syntax for Set Operation
niox.nikospara.yahoo.com Aug 5, 2009 2:49 PM (in response to dhook.donald.hook.gmail.com)The value of an editable component must be a r-value, ie an expression to which values can be assigned to. Is the following legal in Java? That's what you are trying to do.
(id > 0 ? id : foo.emptyString) = 1234;
One way to mimic the desired functionality is a synthetic property:
// NOTE: Error handling is left out public String getSpecialExchangeId() { if( exchangeId == null || exchangeId.intValue() <= 0 ) return ""; else return exchangeId.toString(); } public void setSpecialExchangeId(String x) { Integer newid = new Integer(x); if( newid.intValue() > 0 ) exchangeId = newid; else exchangeId = null; // or anything appropriate }
A more appropriate way would be to implement a standard javax.faces.convert.Converter that implements the desired behavior and register it to the input component.
-
2. Re: Illegal Syntax for Set Operation
niox.nikospara.yahoo.com Aug 5, 2009 2:50 PM (in response to dhook.donald.hook.gmail.com)
Nikos Paraskevopoulos wrote on Aug 05, 2009 14:49:
The value of an editable component must be a r-value,...I mean a l-value...
-
3. Re: Illegal Syntax for Set Operation
dhook.donald.hook.gmail.com Aug 5, 2009 3:18 PM (in response to dhook.donald.hook.gmail.com)Nikos -
Thank you for your feedback. I tried a converter earlier in the debugging process and came across another error, but will revisit to see if I can get it to work. I will let you know what the result is. THANKS!!!
-
4. Re: Illegal Syntax for Set Operation
dhook.donald.hook.gmail.com Aug 7, 2009 4:03 PM (in response to dhook.donald.hook.gmail.com)Nikos - I ended up using the synthetic property that you mentioned since the convertNumber did not work since I was trying to display a space for a value that had zero. I have since implemented a selectOneMenu which works well. Thanks again for your guidance!