tomcat-taglibs-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jason Lea <>
Subject Re: Fw: [OT]Re: <sql:param> null weirdness BACK ON TOPIC
Date Wed, 20 Aug 2003 03:18:16 GMT
Serge Knystautas wrote:

> Jason Lea wrote:
>> So looking at this:
>>   <sql:param><c:out value="${param.time}" /></sql:param>
> Unless you're using c:out to escapeXml your request parameter, or as you 
> say, prevent nulls from entering the database, I'm not sure why you 
> would do this.  Just do
> <sql:param value="${param.time}" />
> Then if param.time is null, it stores null in the database.

Rick explained that param.time is always passed as a parameter (as it is 
a form field).  But it is sometimes empty, which gives him an empty 
string.  So param.time will never be null.

What he wants is to store null in the database when the form field is 
empty eg when param.time is an empty string.

So when param.time is an empty string:

   <sql:param value="${param.time}" />

tries to store an empty string (which he doesn't want)

and this

   <sql:param><c:out value="${param.time}" /></sql:param>

stores a null (which he does want)

But Rick wants to know if this is the intended behaviour, because this 
looks like it should do the same as the first one.  Can he depend on 
this always working, or might this bug(?) get fixed in future and stop 
his code working.

Jason Lea

View raw message