Search code examples
javascriptjavajspstruts2ognl

Best way to just check endswith() in <s:if test=""> tag including equalsIgnore case in Struts2


What is the best way to check if string ends with particular letters including equalsIgnore case.

I want to achieve something like below + ignore the case sensitivity only by using the struts2 tag and not the jstl tag.

<s:if test="(strDisplay.endsWith('XYZ'))">

Solution

  • Struts2 support function calls via OGNL.

    <s:if test="strDisplay.toUpperCase().endsWith('XYZ')">