Hello
all,
I'm using the
display-tag library to display a list of data on a website. However, I want to
be able to conidionally show a value in a certain field, based on a session
variable.
Example:
I have users who are
registered to subscribers. I also have a "superuser". The superuser can view all
the other users, but only the subscriber to which the user is registered can
modify the user.
This should result
in 2 collumns, username, edit.
In the edit collumn,
I need a link to the editUser page, but that link should only be shown when the
user looking at the page is the subscriber to which the user is
registered.
I have the
subscriberId of the logged in subscriber stored as a session variable, and I
have the subscriberId to which the user is registered sotred in the User object
I put in the list used with the displayTag.
I tried the
following in a DisplaytagColumnDecorator:
User reseller =
(User)pageContext.getSession().getAttribute("user");
Number number = (Number)pageContext.getAttribute("numberRow");
if (number.getResellerId() == reseller.getId()) {
return "<a href="" +
number.getId() +
"\" class=\"remove\">" + number.getId() + "</a>";
} else {
return "";
}
Number number = (Number)pageContext.getAttribute("numberRow");
if (number.getResellerId() == reseller.getId()) {
return "<a href="" +
number.getId() +
"\" class=\"remove\">" + number.getId() + "</a>";
} else {
return "";
}
However, the line
Number number = (Number)pageContext.getAttribute("numberRow"); always results in
the last row of the list...
Does anyone have any
ideas on how to solve this?
Mark
Schrijver
------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________ displaytag-user mailing list displaytag-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/displaytag-user