struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paweł Wielgus <poulw...@gmail.com>
Subject Re: Question about 'if' tag
Date Wed, 23 Sep 2009 18:27:21 GMT
Hi Dennis,
You are nesting tags, it's not possible/permitted,
what You should do is something like:
<s:iterator value="..." id="iter"> or <s:iterator value="..." var="iter">
....
<s:if test="user.canEditCustomer(iter)">

Which simply is naming your iterator variable to "iter" and use it in if tag,
depending on struts2 version it will be id or var.

Best greetings,
Paweł Wielgus.


2009/9/23 Dennis Atkinson <dennisatkinson612@yahoo.com>:
> Hi all.
>
> In my Struts2 application, I have a collection of Customer objects, and various users
have the rights to edit some of them and not others.  I have created a Struts iterator tag,
and in the iterator, I put the various Customer attributes into an HTML table.  All this
works.
>
> In one cell of the table, I have the string "Edit", and if it's clicked, it goes to another
Action class to edit that particular Customer object.  All that works too.
>
> What I want to do is only show the "Edit" string if the user has the right to edit that
Customer.  I'm trying to set a "<s:if" tag to do this, but I am sure I'm not doing it
right (because it's not working).
>
> I am trying:
>
> <s:if test="%{user.canEditCustomer(<s:property>)}">
>
> hoping "property" is the current object in the iteration.  But whatever is happening,
this doesn't do what I hope it does.  Am I anywhere close to the right solution here?
>
> Thanks,
> Dennis
>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message