以下是我的 jsp 中的一个代码片段,它有一个 struts“if”标签。
<s:if test="(isVetRequired.equals(true) && isVetValidationRequired())">
<div id="validateVetDiv">
<table width="100%" border="0" cellspacing="1">
<tr style="vertical-align: top;">
<td width="30%"><s:text name="label.vet.certificate" />: <span class="req_field">*</span></td>
<td width="35%">
<!-- <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')}" /> -->
<s:select
cssStyle="width: 95%;"
list="vetCompanyList" listKey="name" listValue="name"
name="vetCompany" id="vetCompany" headerKey="-1"
headerValue="%{getText('select.vet.company')}" />
</td>
<td width="35%">
<div align="left"><s:submit name="butValidateVet"
action="validateVet" id="butValidateVet"
value="%{getText('label.validate')}" /><span class="style3"
id="vetCert"><label> <s:if
test="vetValidityStatus == null"> </s:if><s:elseif
test="vetValidityStatus == @lk.icta.erl.action.RevenueLicenseIssuanceServiceAction@VALIDATION_STATUS_VALID">
<label class="label_valid_certificate"><strong><s:property
value="getText('message.valid.status')" /></strong></label>
</s:elseif> <s:elseif
test="vetValidityStatus == @lk.icta.erl.action.RevenueLicenseIssuanceServiceAction@VALIDATION_STATUS_INVALID">
<label class="label_invalid_certificate"><strong><s:property
value="getText('message.invalid.status')" /></strong></label>
</s:elseif></label></span></div>
</td>
</tr>
<tr> </tr>
</table>
</div>
</s:if>
isVetValidationRequired() 在动作类中。该方法的实现如下所示。
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;
}
问题是 if 标记处的条件始终评估为 false 并且表格不显示。我调试了系统,发现方法返回的值是真的。桌子仍然没有出现。这可能是什么原因?
先感谢您。