You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Hubert Trzewik <ht...@prosystel.com.pl> on 2004/05/12 18:09:43 UTC

woody: null instead of empty string if field left empty

I have a problem with woody.
Let's say I store filled form in SQL DB.

On woody exit an XSP page is fired. Inside XSP SQL query is builded.

Let say form has 4 fields. We filled two first, and the 3rd and 4th we
left empty.

SQL query I get in result is:
INSERT INTO onetable VALUES ('filled field1', 'filled field2', 'null',
'null');

instead of:
INSERT INTO onetable VALUES ('filled field1', 'filled field2', '', '');

How I can easy get rid off of those 'null's?

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: woody: null instead of empty string if field left empty

Posted by Joerg Heinicke <jo...@gmx.de>.
On 12.05.2004 18:09, Hubert Trzewik wrote:

> I have a problem with woody.
> Let's say I store filled form in SQL DB.
> 
> On woody exit an XSP page is fired. Inside XSP SQL query is builded.
> 
> Let say form has 4 fields. We filled two first, and the 3rd and 4th we
> left empty.
> 
> SQL query I get in result is:
> INSERT INTO onetable VALUES ('filled field1', 'filled field2', 'null',
> 'null');
> 
> instead of:
> INSERT INTO onetable VALUES ('filled field1', 'filled field2', '', '');
> 
> How I can easy get rid off of those 'null's?

Woody returns Java null, not the String "null", so you can easily/safely 
do something like

String value == field.getValue();
if (value == null) {
     value = "";
}

Joerg

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org