Note that there are some explanatory texts on larger screens.

plurals
  1. POStruts 2 "<s:if>" tag doesn't work as expected
    primarykey
    data
    text
    <p>Following is a code snippet from my jsp which is having a struts "if" tag. </p> <pre><code> &lt;s:if test="(isVetRequired.equals(true) &amp;&amp; isVetValidationRequired())"&gt; &lt;div id="validateVetDiv"&gt; &lt;table width="100%" border="0" cellspacing="1"&gt; &lt;tr style="vertical-align: top;"&gt; &lt;td width="30%"&gt;&lt;s:text name="label.vet.certificate" /&gt;:&amp;nbsp;&lt;span class="req_field"&gt;*&lt;/span&gt;&lt;/td&gt; &lt;td width="35%"&gt; &lt;!-- &lt;s:select cssClass="txt290" list="#{'CleanCo Lanka (Pvt) Ltd':'CleanCo Lanka (Pvt) Ltd', 'Laugfs Eco Sri (Pvt)':'Laugfs Eco Sri (Pvt)', 'Drive Green (Pvt) Ltd':'Drive Green (Pvt) Ltd'}" name="vetCompany" id="vetCompany" headerKey="-1" headerValue="%{getText('select.vet.company')}" /&gt; --&gt; &lt;s:select cssStyle="width: 95%;" list="vetCompanyList" listKey="name" listValue="name" name="vetCompany" id="vetCompany" headerKey="-1" headerValue="%{getText('select.vet.company')}" /&gt; &lt;/td&gt; &lt;td width="35%"&gt; &lt;div align="left"&gt;&lt;s:submit name="butValidateVet" action="validateVet" id="butValidateVet" value="%{getText('label.validate')}" /&gt;&lt;span class="style3" id="vetCert"&gt;&lt;label&gt; &lt;s:if test="vetValidityStatus == null"&gt;&amp;nbsp;&lt;/s:if&gt;&lt;s:elseif test="vetValidityStatus == @lk.icta.erl.action.RevenueLicenseIssuanceServiceAction@VALIDATION_STATUS_VALID"&gt; &lt;label class="label_valid_certificate"&gt;&lt;strong&gt;&lt;s:property value="getText('message.valid.status')" /&gt;&lt;/strong&gt;&lt;/label&gt; &lt;/s:elseif&gt; &lt;s:elseif test="vetValidityStatus == @lk.icta.erl.action.RevenueLicenseIssuanceServiceAction@VALIDATION_STATUS_INVALID"&gt; &lt;label class="label_invalid_certificate"&gt;&lt;strong&gt;&lt;s:property value="getText('message.invalid.status')" /&gt;&lt;/strong&gt;&lt;/label&gt; &lt;/s:elseif&gt;&lt;/label&gt;&lt;/span&gt;&lt;/div&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt;&amp;nbsp;&lt;/tr&gt; &lt;/table&gt; &lt;/div&gt; &lt;/s:if&gt; </code></pre> <p>isVetValidationRequired() is at the action class. The implementation of that method is shown below. </p> <pre><code> public boolean isVetValidationRequired(){ boolean isVetRequired = true; Fuel fuel = ((Vehicle) getSession().get( SessionConstants.SESSION_VEHICLE)).getFuel(); fuelId = fuel.getFuelId(); if (fuelId == 4 || fuelId == 5) { isVetRequired = false; } return isVetRequired; } </code></pre> <p>The problems is that the condition at if tag always evaluates to false and the table doesn't show up. I debugged the system and found out that the value returned from the method is true. Still the table doesn't show up. What can be the reason for this?</p> <p>Thank you in advance. </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload