struts2标签库使用举例

1.iterator

相当于for循环,其中 <s:property value="top"/>是变量

 <s:iterator begin="pageView.pageindex.startindex" end="pageView.pageindex.endindex">

             < s:if  test ="pageView.currentpage==top" >
                 < b >< font  color ="#FFFFFF" >< s:property  value ="top" /></ font ></ b >
             </ s:if >
             < s:else >
                 < href ="javascript:topage('<s:property value=" top" />')" class="a03"> < font  color ="#FFFFFF" >< s:property  value ="top" /></ a ></ font >
             </ s:else >                                            
         </ s:iterator >

 

 循环取出list中的对象

< s:iterator  value ="pageView.records"  id ="row" >    
         < tr >
             < td  bgcolor ="f5f5f5" >  < div  align ="center" >< s:property  value ="typeid" /></ div ></ td >
             < td  bgcolor ="f5f5f5" >  < div  align ="center" >< href ="" >< img  src ="images/edit.gif"  width ="15"  height ="16"  border ="0" ></ a ></ div ></ td >
             < td  bgcolor ="f5f5f5" >  < div  align ="center" >< s:property  value ="name" /></ div ></ td >
             < td  bgcolor ="f5f5f5" >  < div  align ="center" >< href ="" >创建子类别 </ a ></ div ></ td >
             < td  bgcolor ="f5f5f5"  align ="center" >< s:property  value ="parent.name" /></ td >
             < td  bgcolor ="f5f5f5" >< s:property  value ="memo" /></ td >
         </ tr >

     </s:iterator> 

 

2.待续 

你可能感兴趣的:(struts2标签)