在没有选择条件搜索时,传的值为' ',从后台返回到jsp页面的值' '默认和值为0的选项匹配了,所以在值为0的选项在加上不为' ‘的条件就OK了
未解决代码
<td style="vertical-align:top;padding-left:2px;">
<select class="" name="STA" id="STATUS" data-placeholder="请选择状态" style="vertical-align: top; width: 120px;">
<option value="" <c:if test="${pd.STA=='' }">selected</c:if>>全部</option>
<option value="0" <c:if test="${pd.STA==0}">selected</c:if>>有效</option>
<option value="1" <c:if test="${pd.STA==1}">selected</c:if>>无效</option>
</select>
</td>
解决后代码<td style="vertical-align:top;padding-left:2px;">
<select class="" name="STA" id="STATUS" data-placeholder="请选择状态" style="vertical-align: top; width: 120px;">
<option value="" <c:if test="${pd.STA=='' }">selected</c:if>>全部</option>
<option value="0" <c:if test="${pd.STA==0 && pd.STA != ''}">selected</c:if>>有效</option>
<option value="1" <c:if test="${pd.STA==1}">selected</c:if>>无效</option>
</select>
</td>