Author Topic: need some help with zk  (Read 1196 times)

0 Members and 1 Guest are viewing this topic.

Offline Shivan Hunter

  • 210
  • FRED needs lambdas!
need some help with zk
For those of you who aren't familiar with zk, here's a link.

For those who are, a question: how are the if and unless attributes supposed to work with booleans from a Java class?

To clarify, my CS class is building a web app called 'FaceBooklet', which is what it sounds like: a bare-bones Facebook-like thingus which can store and view users' profiles.

Anyway, there's a method in my ProfileViewer class which determines if the profile being viewed is for the person logged in, or someone else. It works correctly, as does the mechanism for viewing profiles. For instance, I have two profiles, Test1 and Test2. I'm logged in to Test1. This ZK element:

Code: [Select]
<text value="@{PV.isViewingCurrentUser}" /> <!-- PV is an instance of my ProfileViewer object -->
will display "true" if I'm viewing Test1, and "false" if I'm viewing Test2. So the method is functioning correctly, and is communicating with the ZK page.

The problem is, I can't seem to get the if and unless attributes to work right. For those who don't know, an element such as <div if="false"> would not be displayed. I have seen examples where <element if="@{class.booleanMethod}"> have been used correctly. But when I try this on my isViewingCurrentUser method, using the line

Code: [Select]
<div if="@{PV.isViewingCurrentUser}">
the method seems to always return false. I have no idea why this isn't working