You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "heberraja@gmail.com" <he...@gmail.com> on 2017/11/24 12:01:36 UTC
Converting struts1 tag to struts2 null handling
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.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Converting struts1 tag to struts2 null handling
Posted by Lukasz Lenart <lu...@apache.org>.
2017-11-24 13:01 GMT+01:00 heberraja@gmail.com <he...@gmail.com>:
> <s:if test='%{! #row.type.equals("head")}'>
<s:if test='#row.type != "head"'>
?
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
Re: Converting struts1 tag to struts2 null handling
Posted by Yasser Zamani <ya...@apache.org>.
On 11/24/2017 3:31 PM, heberraja@gmail.com wrote:
> <s:if test='%{! #row.type.equals("head")}'>
>
> How to make this true when #row.type is null.
I tested below instead, and works:
<s:if test='%{! "head".equals(#row.type)}'>
However, you pointed an important note out. It caused that I think maybe
it was better to throw an NPE in such cases.
Thanks for your report,
Yasser.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org