« struts入门:struts实现用户登陆(推荐,很完整的讲解)« »Struts标签:notEmpty notPresent异同 »
struts框架 taglib 之logic:present和logic:notPresent

<logic:present>及<logic:notPresent>判定指定的http请求,cookie,header,安全角色,用户,javabean是否存在,根据判断结果来控制内容的输出,标签属性分别为:

cookie:指定的cookie是否存在

header:指定的http请求的header是否存在

role:判断当前通过权限的用户是否具有指定的安全角色.多个安全角色之间以逗号隔开

user:判断当前通过权限验证的用户是否拥有指定用户名

parameter:判断指定的请求参数(相当于getParameter==null)是否存在

name:判断指定的javaBean(属性,attribute)是否存在

scope:设置http请求范围,貌似只能是request或session(??未确定),设为session的时候,包括session,request范围的JavaBean,缺省下好像是session的

proerty:同时设置name与property,判定该名称的JavaBean的property指定的属性是否存在,并且是否为null

例如代码:

<%
request.setAttribute("nothing","nothing");
%>
<logic:present name="nothing" scope="request">
forever love;
</logic:present>

notPresent:标签例如:

<logic:present name="nothing" property="someProperty">
String...................................................................................

<logic:present name="nothing" property="someProperty"/>

Header判断:

<logic:present header="user-agent">
Yep,we got a user-agent header.

</logic:present>

 


Tags: taglib  logic  present  notPresent  struts  

原创文章如转载,请注明:转载自:飞扬部落编程仓库 : http://www.busfly.net/csdn/

本文链接地址:http://www.busfly.net/csdn/post/struts-taglib-logic-present-notPresent.html

如果你喜欢本文,请顶一下,支持我,你的支持是我继续发好文章的最大动力。谢谢。
好东西需要分享,快把本文发给你的朋友吧~!~

     
相关文章:




◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。
Feed订阅集
网站分类
勤劳致富^.^
最近发表
最新评论及回复
最近留言
随机推荐文章
Powered By Z-Blog   STYLE by busfly . FatMouse
Copyright © 2007 巴士飞扬技术博客. . 沪ICP备07027972号. 会员群1(VS为主):3769186.