>On Tue, 28 May 2002, Paul DuBois wrote:
>
>>  In an EL expression, does the identifier "null" return to the literal
>>  null value, or does it refer to a JSTL variable named "null".
>
>"null" is a keyword in the EL, and it refers to null itself, not a
>variable named "null"

Thanks.

>
>>  For example, if I want to explicitly set a variable to null, does this
>>  do it?
>>
>>  <c:set var="myVar" value="${null}" />
>
>Note that you can't really set a JSP scoped variable to null; you
>can only remove it.  <c:set> is specified to remove a variable when its
>'value' attribute is null.

So, for example:

<c:set var="myVar" scope="session" value="${null}" />

would be equivalent to this?

<% session.removeAttribute ("myVar") %>

>
>>  I can find reference in the JSTL spec to testing whether the result of
>>  an expression is null or empty, but not how to *set* something null
>>  explicitly.
>
>The behavior of <c:set> is discussed in section 4.3; its behavior on null
>values is discussed in a section entitled, "Null & Error Handling".

I've read that section, but I wasn't quite clear on how to interpret
it.  "null" is never used on constant font there, so I wasn't sure whether
it was a keyword.  Thanks for the clarification, that helps.

>
>>  I guess a related question is this: You can use the "empty" operator
>>  to determine whether a value is null or empty; does "eq null" perform
>>  a test that is true *only* for null values?
>
>Right - that's exactly it.  empty tests for null, "", and a few other
>things, primarily for the convenience of a page author who doesn't know
>much about data types.  You can still test directly against null using the
>'null' keyword.
>
>Shawn


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to