You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Eric Lentz <er...@outfastsource.com> on 2013/02/26 16:36:27 UTC

OGNL time sink - combining two variables with (&&)

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?

Re: OGNL time sink - combining two variables with (&&)

Posted by Eric Lentz <er...@outfastsource.com>.
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 <er...@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?
>
>

Re: OGNL time sink - combining two variables with (&&)

Posted by Lukasz Lenart <lu...@apache.org>.
2013/2/26 Eric Lentz <er...@outfastsource.com>:
> 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."

I don't see anything like this /proper/commons-lang/uage-guide.html,
could you point me to the right direction?

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

It is always a problem with dynamic languages which are compiled on
the fly ;-) And OGNL is the first class citizen, there was plans to
MVEL but it isn't sufficient enough ;-)
Did you try to use the debug console?
http://struts.apache.org/development/2.x/docs/debugging-struts.html

And your confusion can be related to missing links which are related
to migration process to the new CMS and publishing option ;-)


Regards
-- 
Ɓukasz
+ 48 606 323 122 http://www.lenart.org.pl/

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