struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Eric Lentz <>
Subject OGNL time sink - combining two variables with (&&)
Date Tue, 26 Feb 2013 15:36:27 GMT
I'm approving of Struts 2 and encourage its use, but I have 1 main
complaint: OGNL. Here's an example.


<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?

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message