logic标签用法

logic

    <logic:iterate>

<%

        Dog dog1=new Dog();

        dog1.setAge(2);

        dog1.setName("xiaoming");

        

         Dog dog2=new Dog();

        dog2.setAge(2);

        dog2.setName("xiaoming");

         Dog dog3=new Dog();

        dog3.setAge(2);

        dog3.setName("xiaoming");

        

        LinkedList linkedList=new LinkedList();

        linkedList.add(dog1);

        linkedList.add(dog2);

        linkedList.add(dog3);

        request.setAttribute("dogList",linkedList);

     %>

     

     <h1>strust-logic</h1>

     <logic:iterate id="dog" name="dogList">

         ${dog.name}||${dog.age}

     </logic:iterate>

name:是指域对象的名字。id是要集合中的单个对象

    <logic:empty〉

判断是否是空对象    

<logic:empty name="ww">

         ww不存在

</logic:empty><logic:netEmpty>

判断不为空

<logic:notEmpty name="dogList">

        dogList中存在的

</logic:notEmpty><login:greaterThan>

<logic:greaterThan value="20" name="dog" property="age">

             ${dog.age }大于20

 </logic:greaterThan>

如果name这个对象的属性大于20就输出。

 

你可能感兴趣的:(log)