Struts 2 - struts tag with boolean property

Struts 2 - struts tag <s:if test= "booleanVaue" > with boolean property

Always remember two points --

1) Check your bean (.java) file for getter, setter for boolean type value
  private boolean isTest;
  private boolean hasCheck;

   public boolean isTest() {
        return isTest;

    public void setTest(boolean isTest) {
        this.isTest= isTest;

   public boolean isHasCheck() {
        return hasCheck;

    public void setHasCheck(boolean hasCheck) {
        this.hasCheck= hasCheck;


On a jsp page if you are using these two variables in a <s:if> conditions

<s:if test="isTest">
// This will not work, will always return blank value as isTest is conflicting with getter method isTest();

<s:if test="hasCheck">
  // This will work whatever the value you have set from action

Popular posts from this blog

Can not connect to git using ssh (Permissions 0644 for '/root/.ssh/id_rsa' are too open.

Upload file on Google cloud storage using Java servlet on google app engine

Session timeout interceptor in struts 2