This problems seems to be related to the version of tomcat being used:

I came accross this post online :

http://forums.sun.com/thread.jspa?forumID=427&threadID=5273588

and then tried 6.0.18 and 6.0.14. Previously I was using 6.0.16. The problem indeed does not appear in 6.0.14, however both 6.0.16 and 18 are affected by it.

I found some other posts on this issue as well :

http://www.icefaces.org/JForum/posts/list/8024.page and 
https://issues.apache.org/jira/browse/MYFACES-1979

I wonder what has changed, and how I can fix this
Alex

On 19 Oct 2008, at 21:04, Alexander Hartner wrote:

After having had the problem with null values not being returned as nulls and reading some suggestion solution I added a converter to my application.

...
 <converter>
   <converter-id>NullStringConverter</converter-id>
   <converter-for-class>java.lang.String</converter-for-class>
<converter- class>com.j2anywhere.addressbookserver.web.NullStringConverter</ converter-class>
 </converter>
...


I then implemented it as follows:

...
public String getAsString(FacesContext context, UIComponent component, Object object)
 {
   System.out.println("Converting to String : "+object);

   if (object == null)
   {
     System.out.println("READING null");
     return "NULL";
   }
   else
   {
     if (((String)object).equals(""))
     {
       System.out.println("READING null (Second Check)");
       return null;
     }
     else
     {
       return object.toString();
     }
   }
 }

public Object getAsObject(FacesContext context, UIComponent component, String value)
 {
System.out.println("Converting to Object: "+value +"-"+value.trim().length());
   if (value.trim().length()==0 || value.equals("NULL"))
   {
     System.out.println("WRITING null");
     return null;
   }
   else
   {
     return value.toUpperCase();
   }
 }
...


I can see that it is converting my values, however the object to which the inputText fields are bound are still set to empty strings ""

<h:inputText size="50" value="#{addressBookController.contactDetails.information}" converter="NullStringConverter"/>


Also when reading the object values any nulls are already converted to empty strings before ariving at the converter. It seems that there is a default converter handling string values.

How can I resolve this problem as set nulls when the input value is an empty string other then checking every string in my class individually. I would really hate to pollute my object model with empty string tests.

Thanks in advance


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to