logic:equal,logic:present用法

logic:equal,logic:present用法

1.

<logic:equal value="a" name="documentContent">显示</logic:equal>

 

<logic:equal name="DeliverProveForm" property="userAction" value="create">

如果DeliverProveForm里的属性userAction的值等于create就执行这儿。

</logic:equal>

2. <logic:present name="tipmsg"> 如果在你的action中设置了tipmsg就执行到这儿。如:request.setAttribute("tipmsg","提示信息") 或session.setAttribute("tipmsg","提示信息") <bean:write name="tipmsg"/> </logic:present>

 

----------------------------------------------------------------------------

标签<logic:present>的使用

request.getSession().setAttribute("pageBean", pageBean);

request.setAttribute("result", pageBean.getObjList());

 

在jsp中:

<logic:present name="result">        

<logic:iterate id="book" name="result">             

<logic:present name="book">               

   <tr>                    

  <td><bean:write name="book" property="name" /></td>                     

<td><bean:write name="book" property="author" /></td>                     

<td><bean:write name="book" property="price" /></td>                  

</tr>              

</logic:present>         

</logic:iterate>

</logic:present>

<logic:present name="result" scope="session">

这里有个scope属性可能是request,session等, name指的是一个对象,可能是javaBean,也可能是集合的对象,整个意思就是就是在scope(session,request) 范围里面查找name(一个对象)是否存在,相当于一个if()语句.

posted @ 2012-04-26 16:55  残星  阅读(8381)  评论(0编辑  收藏  举报