1
votes

In jstl, we can declare a variable with empty value like below -

<c:set var="isCompleted" value=""/>

Now suppose, I have a tag named testBoolean.tag where I have a boolean attribute

<%@ attribute name="completed" type="java.lang.Boolean" required="true" %>

Clearly the type is Object boolean, so I should be able to pass null.

But when I pass an empty value to the tag -

<tagDir:testBoolean completed=${isCompleted}/>

it automatically converting empty to False!

Is there any way we can pass null to boolean attribute here?

1
Looks like boolValue is a primitive boolean not an object Boolean - Jens

1 Answers

-1
votes

In your custom tag you must have given type of boolValue as boolean which by default makes it false if no value is provided or the string is anything other than true. If you want exact value which you set, try making its type as String.