Search code examples
jspjsp-tags

What is the difference between using "logic:equal" and "logic:notEqual" tags?


For example, I can have a code like:

<logic:equal name="userForm" property="isRishi" value="YES">
  Welcome, your name is Rishi</logic:equal>

And another code like this:

<logic:notEqual name="userForm" property="isRishi" value="NO">
  Welcome, your name is Rishi</logic:notEqual>

Both would function the same. So what difference is there in using these two tags?


Solution

  • If there are only two possible values, the only difference is that the second form is harder to understand due to the double negation.

    If isRishi can have values other than "YES" and "NO" (e.g. null) then the difference should be obvious.