Got it!

<s:if test='#reviewer.reviewerStatus == "R" && #isAdmin'>

Just needed the "#" on isAdmin. Sigh.


On Tue, Feb 26, 2013 at 10:36 AM, Eric Lentz <ericle...@outfastsource.com>wrote:

> I'm approving of Struts 2 and encourage its use, but I have 1 main
> complaint: OGNL. Here's an example.
>
> Context:
>
> <s:iterator var="reviewer"  // value is a List of a domain object
> #reviewer.reviewerStatus   // equals "R"
>
> <s:set var="isAdmin" value="true" />
>
> When I do this:
> <s:if test='#reviewer.reviewerStatus == "R"'>
> I get into the if condition. This is good.
>
> When I do this:
> <s:if test='isAdmin'>
> I get into the if condition. This is also good.
>
>
> When I do this:
> <s:if test='isAdmin && #reviewer.reviewerStatus == "R"'>
> I DO NOT get into the if condition.
>
> I also tried:
> <s:if test='isAdmin=="true" && #reviewer.reviewerStatus == "R"'>
> <s:if test='isAdmin==true && #reviewer.reviewerStatus == "R"'>
> <s:if test='isAdmin and #reviewer.reviewerStatus == "R"'>
> reordering the variables around &&
> using equals()
>
> None work.
>
> So I go to the OGNL website to make sure I'm doing this right and I get a
> 404 when I try to get the language guide:
> "The requested URL /proper/commons-lang/uage-guide.html was not found on
> this server."
>
> My feeling is that OGNL has always been the ugly step sister in Struts 2.
> It feels like OGNL, as a framework, has been a hot potato and nobody really
> WANTS to maintain it and grow it into the powerful utility it could be. Any
> time I have ever wasted time trying to do something that should be simple,
> I can usually point back to OGNL as the culprit. </my opinion></minor rant>
>
> Anyway, any ideas on what I'm doing wrong?
>
>

Reply via email to