In my application, I am using JSF and Java Web Services. When any of my web-service functions return a null
value, it is always expressed as a "null" string. As a consequence, I cannot use EL expressions like #{empty object}
to test for null
values or empty strings.
I'd like to ask if there's a way to configure such that Java Web Services will return null
value as an empty string OR JSF/EL can understand "null" string as null
value.
if you,
using SOAP, you must remember that the SOAP message is an XML, so you can return an empty String as
null
orempty object
using HTTP or REST, you must remember that the HTTP using type of
String
to serialize the object and informationsSo you have choose:
right serialization of return objects. If you using SOAP, remember Base64 encoding.
right output value for errors. You can serialize directly the exceptions or your custom message codes.
I hope to help you.