Ognl经常使用标签:   

  1、s:debug
      假设把该标签放入到s:iterator中能够看到当前正在迭代的元素的状态
   2、s:property
      1、输出
      2、value属性:值能直接跟ognl表达式
      3、假设value属性不写。则默认输出栈顶的元素
   3:s:iterator标签
      (1)、iterator迭代Collection,Map,Object[],还能够以组合的形式迭代
      (2)、当前正在迭代的元素在栈顶
      (3)、假设value属性不写,则默认迭代栈顶的元素
      (4)、假设迭代的是map元素。当前正在迭代的元素是Entry<key,value>,这个时候key和value是对象栈
         中的属性
       (5)、var属性,var='aa'相当于给当前正在迭代的元素在map栈又存放了一次,key值为aa
       (6)、status属性,能够获取当前正在迭代的元素的信息count,index,odd,event,查看IteratorStatus这个类
       (7)、end,first,step属性
   4、s:if  s:elseif
       注意:不能使用单个字符进行推断
             <s:if test="name==1">   <s:if test="name=='1'">这样的写法不正确

========================演示样例:
1.在Action中将数据存入valuestack中;
public String putListToMap(){
          List<Person> personList = new ArrayList<Person>();    
          Person p= null;
           for (int i = 0; i < 50; i++) {
              p= new Person();
               if(i%3==0){
                   p.setPid( "aa");
                   p.setUsername( "P"+i);
              }
               if(i%3==1){
                   p.setPid( "bb");
                   p.setUsername( "p"+i);
              }
               if(i%3==2){
                   p.setPid( "cc");
                   p.setUsername( "p"+i);
              }
              personList.add(p);
              
          }
          
          ActionContext. getContext().put("pList", personList);
           return "list_map" ;
     }

2.在jsp页面迭代显示集合数据:
<style type= "text/css">
           .odd{
               background-color:red ;
          }
           .even{
               background-color:blue ;
          }
           .blue{
               background-color:yellow ;
          }
           .red{
               background-color:red ;
          }
  </style >

<s:iterator value= "#pList" var ="aa" status="statu">
          
               <!-- 每三行变色 status 使用s:debug能够查看到该类为IteratorStatus -->
               <tr class= "<s:property value="#statu.index%3==0?'blue':'red'" />">
               <%--<tr class="<s:property value="#statu.even?'even':'odd'"/>">
                   --%>
                    <td>
                         <s:property value= "pid"/>
                    </td>
                    <td>
                         <s:property value= "username"/>
                    </td>
                    <td>
                         <s:property value="#statu.count" />
                    </td>
                    <td>
                         <s:if test= "#statu.odd">
                             奇数行
                         </s:if>
                         <s:elseif test= "#statu.even">
                             偶数行
                         </s:elseif>
                    </td>
                    <td>
                         <s:property value="#statu.index" />
                    </td>
                    <td>
                         <s:if test="pid=='aa'||pid=='bb'" >
                              <input type= "button" name="adsf" value="改动">
                         </s:if>
                    </td>
                    <td>
                         <s:if test="pid=='cc'||pid=='aa'" >
                              <input type= "button" name="adsf" value="删除">
                         </s:if>
                    </td>
               </tr>
           </s:iterator>
  


显示结果图: