Converting struts1 tag to struts2 null handling

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Converting struts1 tag to struts2 null handling

heberraja@gmail.com


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: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Converting struts1 tag to struts2 null handling

Yasser Zamani-2


On 11/24/2017 3:31 PM, [hidden email] 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: [hidden email]
For additional commands, e-mail: [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: Converting struts1 tag to struts2 null handling

Lukasz Lenart
In reply to this post by heberraja@gmail.com
2017-11-24 13:01 GMT+01:00 [hidden email] <[hidden email]>:
> <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: [hidden email]
For additional commands, e-mail: [hidden email]