使用OGNL表达式 输出结果为第一季度<s:set name="month" value="1" />
<s:if test="#month>0 && month<=3">
第一季度
</s:if>
<s:elseif test="#month>3 && month<=6">
第二季度
</s:elseif>
<s:elseif test="#month>6 && month<=9">
第三季度
</s:elseif>
<s:elseif test="#month>9 && month<=12">
第四季度
</s:elseif>
<s:else>
输入错误
</s:else>
使用EL表达式 输出结果为输入错误<s:set name="month" value="1" />
<s:if test="${month>0 && month<=3}">
第一季度
</s:if>
<s:elseif test="${month>3 && month<=6}">
第二季度
</s:elseif>
<s:elseif test="${month>6 && month<=9}">
第三季度
</s:elseif>
<s:elseif test="${month>9 && month<=12}">
第四季度
</s:elseif>
<s:else>
输入错误
</s:else>
不知道何解?

解决方案 »

  1.   

    不知道你要问什么?
    是问他们的区别还是问他们的用法?
    jsp的书上都有EL的详解
      

  2.   

    <s:set name="month" value="1" />
    改成<c:set name="month" value="1" />
    试试!!!
      

  3.   

    to:Spanker_liao
    Struts2 有c么?
    你说的是Struts的core包么?
      

  4.   

    <s:set name="month" value="1" />
    _________________________________改成 <s:set name="month" value="1" scope="page"/> 试试看。
      

  5.   

    Struts2.01.遍历Map 
    Java代码 
        <s:iterator value="#request.map" status="idx">   
    <tr>   
      <td ><input type="checkbox" id="<s:property value="#idx.index"/>" value="checkbox" onclick="checkParentBox('<s:property value="#idx.index"/>',<s:property value="value.size"/>);"/></td>   
      <td ><s:property value="key.resName"/></td>   
      <td >   
      <s:iterator value="value" id="perm" status="idxp">   
            <input type="checkbox" <s:if test="#perm.permId in #request.permList">checked="checked"</s:if> id="<s:property value="#idx.index"/>_<s:property value="#idxp.index"/>" name="permIds" value="<s:property value="#perm.permId"/>"  onclick="checkSubbox('<s:property value="#idx.index"/>',<s:property value="value.size"/>)"/><s:property value="#perm.permName"/>   
      </s:iterator>         
      </td>   
    </tr>   
    </s:iterator>        <s:iterator value="#request.map" status="idx">
      <tr>
        <td ><input type="checkbox" id="<s:property value="#idx.index"/>" value="checkbox" onclick="checkParentBox('<s:property value="#idx.index"/>',<s:property value="value.size"/>);"/></td>
        <td ><s:property value="key.resName"/></td>
        <td >
        <s:iterator value="value" id="perm" status="idxp">
              <input type="checkbox" <s:if test="#perm.permId in #request.permList">checked="checked"</s:if> id="<s:property value="#idx.index"/>_<s:property value="#idxp.index"/>" name="permIds" value="<s:property value="#perm.permId"/>"  onclick="checkSubbox('<s:property value="#idx.index"/>',<s:property value="value.size"/>)"/><s:property value="#perm.permName"/>
        </s:iterator>      
        </td>
      </tr>
      </s:iterator>2.遍历LIST 
    Java代码 
    <s:iterator value="#request.page.data" status="sta">   
    lt;tr>   
     <td><input type="checkbox" name="ids" value='<s:property value="equipmentId" />' onclick="checkState('f1',this)"/></td>   
     <td ><s:property value="equipmentNo"/></a></td>   
     <td ><a href="${ctx}/resource/equip!detail.action?ids=<s:property value="equipmentId"/>"><s:property value="equipmentName"/></a></td>   
     <td>   
        <c:if test="${borrowState eq 0 }">未借</c:if>   
        <c:if test="${borrowState eq 1 }">已借</c:if>   
      </td>   
     <td>   
        <c:if test="${useState eq 0 }">完好</c:if>   
        <c:if test="${useState eq 1 }">报修</c:if>   
        <c:if test="${useState eq 2 }">报废</c:if>   
     </td>   
     </tr>   
    </s:iterator>  
      

  6.   

    <s:set name="month" value="1" /> 把这个改为:
    <s:set name="month" value="'1'"/>
    注意有单引号
      

  7.   


    Niu   初学乍练  有待进一步学习呀
      

  8.   

    el标签和s标签不能嵌套着用  
      

  9.   

    ${month==1?2:3}  el表达的是if  else 是这样用的  不知道还来得及吗!