boolean or Boolean

so ive been a little confused over this for a little while. Ive got a jsp site set up, the "customer" logs in, and thier info is pulled from a database. this "customer" could be set up for automatic payments and there is a field in the db that stores this. an action called "Customer" pulls the info from the db and the jsp accesses this action.

the reason i was so confused was because when i use ${!Customer.directDebitPaySetUp} it displays true, no matter what.

if i insert ${Customer.directDebitPaySetUp} it doesn't display anything, and is actually null. but if i access the variable directly through something like com.arvig.www.ebpp.Customer.directDebitPaySetUp then it will display the actual value that I'm looking for, the problem is if I access it directly like that i cant put it into an c:if statement because it comes through as a Boolean (java.lang.Boolean object) value instead of a primitive boolean which is what the c:if is expecting.

any help would be great!

Message was edited by:

Rob17

[1049 byte] By [Rob17a] at [2007-11-27 8:01:21]
# 1

I suppose you could write a custom tag to convert a Boolean into boolean, and then use the result in the <c:if>... I've never fallen afowl of this one... but I've allways stored booleans in the DB as char 'Y' or 'N'.

Thanks for the heads up though.. and sorry I can't actually answer the question... it's quit a good one.

Keith.

corlettka at 2007-7-12 19:43:26 > top of Java-index,Java Essentials,New To Java...
# 2
i did some search previously and found some information about a toPrimitive() function - http://www.zkoss.org/javadoc/2.3.0/zcommon/org/zkoss/lang/Primitives.htmlbut i havnt been able to successfully implement it.
Rob17a at 2007-7-12 19:43:26 > top of Java-index,Java Essentials,New To Java...
# 3
anyone?
Rob17a at 2007-7-12 19:43:26 > top of Java-index,Java Essentials,New To Java...
# 4
Can you not just call the booleanValue() method on the Boolean to get the primitive? http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Boolean.html#booleanValue()
hunter9000a at 2007-7-12 19:43:26 > top of Java-index,Java Essentials,New To Java...
# 5

i tried that previously as well, this was the result

<c:if test="${booleanValue(com.arvig.www.ebpp.Customer.directDebitPaySetUp)}">

Error:

'booleanValue' is an unknown function.

Message was edited by:

Rob17

Rob17a at 2007-7-12 19:43:26 > top of Java-index,Java Essentials,New To Java...
# 6
Would you want this instead?<c:if test="${com.arvig.www.ebpp.Customer.directDebitPaySetUp.booleanValue()}">Message was edited by: bryano
bryanoa at 2007-7-12 19:43:26 > top of Java-index,Java Essentials,New To Java...
# 7

> i tried that previously as well, this was the result

>

> <c:if

> test="${booleanValue(com.arvig.www.ebpp.Customer.direc

> tDebitPaySetUp)}">

>

>

> Error:

>

> /ebpp/splash.jsp:50: cannot resolve symbol

> symbol : method booleanValue (java.lang.Boolean)

> location: class _jsp._ebpp._splash__jsp

> out.print((

> booleanValue(com.arvig.www.ebpp.Customer.directDebitPa

> ySetUp) ));

Ok, I'm really not trying to be mean, but you should really go back and learn the basics of java. If you can't call a method on an object, you're getting ahead of yourself.

<c:if test="${com.arvig.www.ebpp.Customer.directDebitPaySetUp.booleanValue()}">

hunter9000a at 2007-7-12 19:43:26 > top of Java-index,Java Essentials,New To Java...
# 8
sorry to inconvenience you, i thought this was the New To Java forum. i must have been mistaken.
Rob17a at 2007-7-12 19:43:26 > top of Java-index,Java Essentials,New To Java...
# 9

> sorry to inconvenience you, i thought this was the

> New To Java forum. i must have been mistaken.

It's ok, I'm not saying I won't help you, it's just that you'd do yourself a favor by learning the basics first. If you focused your energy in getting a foundation in java these problems would be easy to fix yourself. I'm trying to give you helpful advice.

hunter9000a at 2007-7-12 19:43:26 > top of Java-index,Java Essentials,New To Java...
# 10
thanks, i understand, i shouldn't have made a sarcastic remark. its been a long day of staring at code, my mind is a bit fried at the moment. sorry, and thanks for all the advice everyone!
Rob17a at 2007-7-12 19:43:26 > top of Java-index,Java Essentials,New To Java...