title: Calling java method with parameters in JSP file using OGNL
body: <p>I am trying to display an image based on certain condition in JSP.</p>
  <pre><code>&lt;s:if test=&quot;%{#employee.ratingInfo.ispromoted!=null &amp;&amp; #employee.ratingInfo.ispromoted.code==56}&quot;&gt;  
      &lt;i class=&quot;check&quot;&gt;&lt;/i&gt;
  &lt;/s:if&gt;
  &lt;s:else&gt;
      &lt;i class=&quot;invalid&quot;&gt;&lt;/i&gt;
  &lt;/s:else&gt;
  </code></pre>
  <p>I want to check if there is a way we can call a function in java by passing <code>employee.ratingInfo.ispromoted.code</code> as a parameter and then based on the return value we can display image. For example:</p>
  <p><strong>JSP:</strong></p>
  <pre><code>&lt;s:if test=&quot;checkRating(#employee.ratingInfo.ispromoted.code)&quot;&gt;  
      &lt;i class=&quot;check&quot;&gt;&lt;/i&gt;
  &lt;/s:if&gt;
  &lt;s:else&gt;
        &lt;i class=&quot;invalid&quot;&gt;&lt;/i&gt;
  &lt;/s:else&gt;
  </code></pre>
  <p><strong>Java:</strong></p>
  <pre><code>public boolean checkRating(int rating){
      if(rating==56){
          return true;
      }
        return false;
  }
  </code></pre>
  <p>Is there a way we can achieve it, if I pass a parameter from a JSP to a method in Java to check if condition?</p>