The following struts 1 code evaluates to true when row.type is null.
<logic:notEqual property="type" name="row" value="head">
The same I converted into struts2 as below but it evaluates to false when row.type is null.
<s:if test='%{! #row.type.equals("head")}'>
How to make this true when #row.type is null.
Tried as below still not working.
<s:if test="%{#row.type != null}">
// Control Not going inside
</s:if>
<s:if test='%{(! #row.type.equals("head") ) || #row.type == null}'>
// here also not going inside
</s:if>
Try
<s:if test='%{! "head".equals(#row.type)}'>
Using parentheses helped.
<s:if test='%{ ! ("head".equals(#row.type)) }'>
Related
How can the regexmatch return false while comparing the cell to itself?
part of the text in the cell:
<p>כלבים וילדים מאז ומתמיד נתפסו כדבר חמוד ומתוק מאין כמוהו, בטח כשמדובר בחיבור ביניהם בגילאים הצעירים יותר; אלא שלמרות זאת, חיבור בין כלבים וילדים עלול להפוך למן נטל בעיני ההורים ה'עייפים' שלמעשה נדרשים לטפל בנפש נוספת כתוצאה מצירוף בעל חיים לחיקם.</p>
<!-- /wp:paragraph -->
<!-- wp:paragraph -->
<p>אולם כפי שכולנו כבר יודעים, לא הכל בחיים הוא שחור ולבן – טיפול נכון ומתן הנחיות מתאימות לילדכם עלול להקנות מיומנויות וכלים מצוינים להמשך חייו של האחרון כאדם ערכי ואחראי ביותר.</p>
<!-- /wp:paragraph -->
for comparing cell to itself use:
=L1=L1
keep in mind that certain characters of regex input need to be escaped...
I need to have a condition with logical operator OR. I try to do in this way but it seem doesn't work :
<div th:if="${(fingerprints.totalPages != 0) or (fingerprints.totalPages != 1)}"
How I suppose to do ? :)
Both or and || work. In this case, your logic is wrong. I think your expression should be:
th:if="${(fingerprints.totalPages != 0) and (fingerprints.totalPages != 1)}"
Your original expression is always true. (Since fingerprints.totalPages is always going to be either != 1 or != 0.
I have this condition:
<#if tag.level?? && tag.level == "IMPORTANT">
Is it possible to shorten it to something like this?
<#if tag.level!"" == "IMPORTANT">
If I try this
<#assign tag = {"bar": "AA"} >
${ ((tag.bar)!"x") = "x" }
I get
Can't convert boolean to string automatically, because the "boolean_format" setting was "true,false", which is the legacy default computer-language format, and hence isn't accepted.
See http://freemarker-online.kenshoo.com/
1) ${ ((tag.bar)!"x") = "x" } should be probably ${ ((tag.bar)!"x") == "x" }.
2) Use a built-in to display boolean, either ${ (((tag.bar)!"x") = "x")?c } (if your Freemarker is newer than 2.3.20), or ${ (((tag.bar)!"x") = "x")?string("true", "false") }
It's a precedence issue that you run into. This works:
<#if (tag.level!"") == "IMPORTANT">
but for this kind of default there's a shorter form:
<#if tag.level! == "IMPORTANT">
What is the proper way to cocatenate strings inside if statement?
For ex.:
{if {site_url}{segment_1} == page_url} class="selected" {/if }
I need to concatenate *site_url* and *segment_1* then compare it to *page_url*.
On Expressionegine conditionals you can use
{if {var} == ''} or {if "{var}" == ''}
Maybe it work
{if "{site_url}{segment_1}" == "page_url"} class="selected" {/if }
Is there anyway to do this?
<tr #if (i % 2 == 0) { class="odd" }>
Try it like this
<tr class=#(i % 2 == 1 ? "odd" : "even")>...</tr>